home *** CD-ROM | disk | FTP | other *** search
/ WINMX Assorted Textfiles / Ebooks.tar / Text - Tech - OS - Linux - How to Make a Linux Boot Disk (TXT).zip / BOOTDI~1 next >
Text File  |  2003-09-28  |  103KB  |  2,607 lines

  1.   The Linux Bootdisk HOWTO
  2.   Tom Fawcett (fawcett@croftj.net)
  3.  
  4.  
  5.   v3.6, January 2000
  6.  
  7.   This document describes how to design and build your own boot/root
  8.   diskettes for Linux.  These disks can be used as rescue disks or to
  9.   test new system components.  If you haven't read the Linux FAQ and
  10.   related documents, such as the Linux Installation HOWTO and the Linux
  11.   Install Guide, you should not be trying to build boot diskettes.  If
  12.   you just want a rescue disk to have for emergencies, see Appendix
  13.   ``Pre-made bootdisks''.
  14.   ______________________________________________________________________
  15.  
  16.   Table of Contents
  17.  
  18.  
  19.  
  20.   1. Preface.
  21.  
  22.      1.1 Version notes.
  23.      1.2 Yet to do.
  24.      1.3 Feedback and credits.
  25.      1.4 Distribution policy.
  26.  
  27.   2. Introduction.
  28.  
  29.   3. Bootdisks and the boot process.
  30.  
  31.      3.1 The boot process.
  32.      3.2 Disk types.
  33.  
  34.   4. Building a root filesystem.
  35.  
  36.      4.1 Overview.
  37.      4.2 Creating the filesystem.
  38.      4.3 Populating the filesystem.
  39.         4.3.1 /dev
  40.         4.3.2 /etc
  41.         4.3.3 /bin and /sbin
  42.         4.3.4 /lib
  43.      4.4 Providing for PAM and NSS.
  44.         4.4.1 PAM (Pluggable Authentication Modules).
  45.         4.4.2 NSS (Name Service Switch).
  46.      4.5 Modules.
  47.      4.6 Some final details.
  48.      4.7 Wrapping it up.
  49.  
  50.   5. Choosing a kernel.
  51.  
  52.   6. Putting them together: Making the diskette(s).
  53.  
  54.      6.1 Transferring the kernel with LILO
  55.      6.2 Transferring the kernel without LILO.
  56.      6.3 Setting the ramdisk word.
  57.      6.4 Transferring the root filesystem.
  58.  
  59.   7. Troubleshooting, or The Agony of Defeat.
  60.  
  61.   8. Miscellaneous topics.
  62.  
  63.      8.1 Reducing root filesystem size.
  64.      8.2 Non-ramdisk root filesystems.
  65.      8.3 Building a utility disk.
  66.  
  67.   9. How the pros do it.
  68.  
  69.   10. Frequently asked question (FAQ) list.
  70.  
  71.   11. Resources and pointers
  72.  
  73.      11.1 Pre-made bootdisks.
  74.      11.2 Rescue packages.
  75.      11.3 Graham Chapman's shell scripts
  76.      11.4 LILO -- the Linux loader.
  77.      11.5 Linux FAQ and HOWTOs.
  78.      11.6 Ramdisk usage.
  79.      11.7 The Linux boot process.
  80.  
  81.   12. LILO boot error codes.
  82.  
  83.   13. Sample rootdisk directory listings.
  84.  
  85.   14. Sample utility disk directory listing.
  86.   ______________________________________________________________________
  87.  
  88.   1.  Preface.
  89.  
  90.  
  91.   Note: This document may be outdated. If the date on the title page is
  92.   more than six months ago, please check the Linux Documentation Project
  93.   homepage  <http://linuxdoc.org/HOWTO/Bootdisk-HOWTO.html> to see if a
  94.   more recent version exists.
  95.  
  96.   Although this document should be legible in its text form, it looks
  97.   much better in Postscript (.ps) or HTML because of the typographical
  98.   notation used.  We encourage you to select one of these forms.  The
  99.   Info version, as of this writing, ends up so damaged as to be
  100.   unusable.
  101.  
  102.  
  103.   1.1.  Version notes.
  104.  
  105.  
  106.   Graham Chapman (grahamc@zeta.org.au) wrote the original Bootdisk-HOWTO
  107.   and he supported it through version 3.1.  Tom Fawcett
  108.   (fawcett@croftj.net) added a lot of material for kernel 2.0, and he is
  109.   the document's maintainer as of version 3.2.  Much of Chapman's
  110.   original content remains.
  111.  
  112.   This document is intended for Linux kernel 2.0 and later.  If you have
  113.   an older kernel (1.2.xx or before), please consult previous versions
  114.   of the Bootdisk-HOWTO archived on Graham Chapman's homepage
  115.   <http://www.zeta.org.au/~grahamc/linux.html>.
  116.  
  117.   This information is intended for Linux on the Intel platform.  Much of
  118.   this information may be applicable to Linux on other processors, but
  119.   we have no first-hand experience or information about this.  If anyone
  120.   has experience with bootdisks on other platforms, please contact us.
  121.  
  122.  
  123.  
  124.   1.2.  Yet to do.
  125.  
  126.  
  127.   Any volunteers?
  128.  
  129.  
  130.   1. Describe (or link to another document that describes) how to create
  131.      other bootable disk-like things, such as CDROMs, ZIP disks and
  132.      LS110 disks.
  133.  
  134.   2. Describe how to deal with the huge libc.so shared libraries.  The
  135.      options are basically to get older, smaller libraries or to cut
  136.      down existing libraries.
  137.  
  138.   3. Re-analyze distribution bootdisks.  Upgrade the "How the Pros do
  139.      it" section.
  140.  
  141.   4. Delete section that describes how to upgrade existing distribution
  142.      bootdisks.  This is usually more trouble than it's worth.
  143.  
  144.   5. Rewrite/streamline the Troubleshooting section.
  145.  
  146.  
  147.  
  148.   1.3.  Feedback and credits.
  149.  
  150.  
  151.  
  152.   We welcome any feedback, good or bad, on the content of this document.
  153.   We have done our best to ensure that the instructions and information
  154.   herein are accurate and reliable.  Please let us know if you find
  155.   errors or omissions.
  156.  
  157.   We thank the many people who assisted with corrections and
  158.   suggestions.  Their contributions have made it far better than we
  159.   could ever have done alone.
  160.  
  161.   Send comments, corrections and questions to the author at the email
  162.   address above.  I don't mind trying to answer questions, but please
  163.   read section ``Troubleshooting'' first.
  164.  
  165.  
  166.  
  167.   1.4.  Distribution policy.
  168.  
  169.  
  170.   Copyright (C) 1995,1996,1997,1998,1999,2000 by Tom Fawcett and Graham
  171.   Chapman.  This document may be distributed under the terms set forth
  172.   in the Linux Documentation Project License at
  173.   <http://linuxdoc.org/copyright.html>.  Please contact the authors if
  174.   you are unable to get the license.
  175.  
  176.   This is free documentation.  It is distributed in the hope that it
  177.   will be useful, but without any warranty; without even the implied
  178.   warranty of merchantability or fitness for a particular purpose.
  179.  
  180.  
  181.  
  182.   2.  Introduction.
  183.  
  184.  
  185.   Linux boot disks are useful in a number of situations, such as:
  186.  
  187.   o  Testing a new kernel.
  188.  
  189.   o  Recovering from a disk failure -- anything from a lost boot sector
  190.      to a disk head crash.
  191.  
  192.   o  Fixing a disabled system.  A minor mistake as root can leave your
  193.      system unusable, and you may have to boot from diskette to fix it.
  194.  
  195.   o  Upgrading critical system files, such as libc.so.
  196.  
  197.   There are several ways of obtaining boot disks:
  198.  
  199.  
  200.   o  Use one from a distribution such as Slackware.  This will at least
  201.      allow you to boot.
  202.  
  203.   o  Use a rescue package to set up disks designed to be used as rescue
  204.      disks.
  205.  
  206.   o  Learn what is required for each of the types of disk to operate,
  207.      then build your own.
  208.  
  209.   Some people choose the last option so they can do it themselves.  That
  210.   way, if something breaks, they can work out what to do to fix it.
  211.   Plus it's a great way to learn about how a Linux system works.
  212.  
  213.   This document assumes some basic familiarity with Linux system
  214.   administration concepts.  For example, you should know about
  215.   directories, filesystems and floppy diskettes.  You should know how to
  216.   use mount and df.  You should know what /etc/passwd and fstab files
  217.   are for and what they look like.  You should know that most of the
  218.   commands in this HOWTO should be run as root.
  219.  
  220.   Constructing your own bootdisk from scratch can be complicated.  If
  221.   you haven't read the Linux FAQ and related documents, such as the
  222.   Linux Installation HOWTO and the Linux Installation Guide, you should
  223.   not be trying to build boot diskettes.  If you just need a working
  224.   bootdisk for emergencies, it is much easier to download a
  225.   prefabricated one.  See Appendix ``Pre-made bootdisks'', below, for
  226.   where to find these.
  227.  
  228.  
  229.  
  230.   3.  Bootdisks and the boot process.
  231.  
  232.  
  233.   A bootdisk is basically a miniature, self-contained Linux system on a
  234.   floppy diskette.  It must perform many of the same functions that a
  235.   complete full-size Linux system performs.  Before trying to build one
  236.   you should understand the basic Linux boot process.  We present the
  237.   basics here, which are sufficient for understanding the rest of this
  238.   document.  Many details and alternative options have been omitted.
  239.  
  240.  
  241.   3.1.  The boot process.
  242.  
  243.  
  244.   All PC systems start the boot process by executing code in ROM
  245.   (specifically, the BIOS) to load the sector from sector 0, cylinder 0
  246.   of the boot drive.  The boot drive is usually the first floppy drive
  247.   (designated A: in DOS and /dev/fd0 in Linux).  The BIOS then tries to
  248.   execute this sector.  On most bootable disks, sector 0, cylinder 0
  249.   contains either:
  250.  
  251.   o  code from a boot loader such as LILO, which locates the kernel,
  252.      loads it and executes it to start the boot proper.
  253.  
  254.   o  the start of an operating system kernel, such as Linux.
  255.  
  256.   If a Linux kernel has been raw-copied to a diskette, the first sector
  257.   of the disk will be the first sector of the Linux kernel itself.  This
  258.   first sector will continue the boot process by loading the rest of the
  259.   kernel from the boot device.
  260.  
  261.   Once the kernel is completely loaded, it goes through some basic
  262.   device initialization.  It then tries to load and mount a root
  263.   filesystem from some device.  A root filesystem is simply a filesystem
  264.   that is mounted as ``/''.  The kernel has to be told where to look for
  265.   the root filesystem; if it cannot find a loadable image there, it
  266.   halts.
  267.  
  268.   In some boot situations -- often when booting from a diskette -- the
  269.   root filesystem is loaded into a ramdisk, which is RAM accessed by the
  270.   system as if it were a disk.  There are two reasons why the system
  271.   loads to ramdisk.  First, RAM is several orders of magnitude faster
  272.   than a floppy disk, so system operation is fast; and second, the
  273.   kernel can load a compressed filesystem from the floppy and uncompress
  274.   it onto the ramdisk, allowing many more files to be squeezed onto the
  275.   diskette.
  276.  
  277.   Once the root filesystem is loaded and mounted, you see a message
  278.   like:
  279.  
  280.  
  281.           VFS: Mounted root (ext2 filesystem) readonly.
  282.  
  283.   At this point the system finds the init program on the root filesystem
  284.   (in /bin or /sbin) and executes it.  init reads its configuration file
  285.   /etc/inittab, looks for a line designated sysinit, and executes the
  286.   named script .  The sysinit script is usually something like /etc/rc
  287.   or /etc/init.d/boot.  This script is a set of shell commands that set
  288.   up basic system services, such as:
  289.  
  290.  
  291.   o  Running fsck on all the disks,
  292.  
  293.   o  Loading necessary kernel modules,
  294.  
  295.   o  Starting swapping,
  296.  
  297.   o  Initializing the network,
  298.  
  299.   o  Mounting disks mentioned in fstab.
  300.  
  301.   This script often invokes various other scripts to do modular
  302.   initialization.  For example, in the common SysVinit structure, the
  303.   directory /etc/rc.d/ contains a complex structure of subdirectories
  304.   whose files specify how to enable and shut down most system services.
  305.   However, on a bootdisk the sysinit script is often very simple.
  306.  
  307.   When the sysinit script finishes control returns to init, which then
  308.   enters the default runlevel, specified in inittab with the initdefault
  309.   keyword.  The runlevel line usually specifies a program like getty,
  310.   which is responsible for handling commununications through the console
  311.   and ttys.  It is the getty program which prints the familiar
  312.   ``login:'' prompt.  The getty program in turn invokes the login
  313.   program to handle login validation and to set up user sessions.
  314.  
  315.  
  316.   3.2.  Disk types.
  317.  
  318.  
  319.   Having reviewed the basic boot process, we can now define various
  320.   kinds of disks involved.  We classify disks into four types.  The
  321.   discussion here and throughout this document uses the term ``disk'' to
  322.   refer to floppy diskettes unless otherwise specified, though most of
  323.   the discussion could apply equally well to hard disks.
  324.  
  325.  
  326.  
  327.      boot
  328.         A disk containing a kernel which can be booted.  The disk can be
  329.         used to boot the kernel, which then may load a root file system
  330.         on another disk.  The kernel on a bootdisk usually must be told
  331.         where to find its root filesystem.
  332.  
  333.         Often a bootdisk loads a root filesystem from another diskette,
  334.         but it is possible for a bootdisk to be set up to load a hard
  335.         disk's root filesystem instead.  This is commonly done when
  336.         testing a new kernel.  (in fact, ``make zdisk'' will create such
  337.         a bootdisk automatically from the kernel source code).
  338.  
  339.  
  340.      root
  341.         A disk with a filesystem containing files required to run a
  342.         Linux system.  Such a disk does not necessarily contain either a
  343.         kernel or a boot loader.
  344.  
  345.         A root disk can be used to run the system independently of any
  346.         other disks, once the kernel has been booted.  Usually the root
  347.         disk is automatically copied to a ramdisk.  This makes root disk
  348.         accesses much faster, and frees up the disk drive for a utility
  349.         disk.
  350.  
  351.  
  352.      boot/root
  353.         A disk which contains both the kernel and a root filesystem.  In
  354.         other words, it contains everything necessary to boot and run a
  355.         Linux system without a hard disk.  The advantage of this type of
  356.         disk is that is it compact -- everything required is on a single
  357.         disk.  However, the gradually increasing size of everything
  358.         means that it is increasingly difficult to fit everything on a
  359.         single diskette, even with compression.
  360.  
  361.  
  362.      utility
  363.         A disk which contains a filesystem, but is not intended to be
  364.         mounted as a root file system.  It is an additional data disk.
  365.         You would use this type of disk to carry additional utilities
  366.         where you have too much to fit on your root disk.
  367.  
  368.  
  369.  
  370.   In general, when we talk about ``building a bootdisk'' we mean
  371.   creating both the boot (kernel) and root (files) portions.  They may
  372.   be either together (a single boot/root disk) or separate (boot + root
  373.   disks).  The most flexible approach for rescue diskettes is probably
  374.   to use separate boot and root diskettes, and one or more utility
  375.   diskettes to handle the overflow.
  376.  
  377.  
  378.  
  379.   4.  Building a root filesystem.
  380.  
  381.  
  382.   Creating the root filesystem involves selecting files necessary for
  383.   the system to run.  In this section we describe how to build a
  384.   compressed root filesystem.  A less common option is to build an
  385.   uncompressed filesystem on a diskette that is directly mounted as
  386.   root; this alternative is described in section ``Non-ramdisk Root
  387.   Filesystem''.
  388.  
  389.  
  390.   4.1.  Overview.
  391.  
  392.  
  393.   A root filesystem must contain everything needed to support a full
  394.   Linux system.  To be able to do this, the disk must include the
  395.   minimum requirements for a Linux system:
  396.  
  397.  
  398.   o  The basic file system structure,
  399.  
  400.   o  Minimum set of directories: /dev, /proc, /bin, /etc, /lib, /usr,
  401.      /tmp,
  402.  
  403.   o  Basic set of utilities: sh, ls, cp, mv, etc.,
  404.  
  405.   o  Minimum set of config files: rc, inittab, fstab, etc.,
  406.  
  407.   o  Devices: /dev/hd*, /dev/tty*, /dev/fd0, etc.,
  408.  
  409.   o  Runtime library to provide basic functions used by utilities.
  410.  
  411.   Of course, any system only becomes useful when you can run something
  412.   on it, and a root diskette usually only becomes useful when you can do
  413.   something like:
  414.   o  Check a file system on another drive, for example to check your
  415.      root file system on your hard drive, you need to be able to boot
  416.      Linux from another drive, as you can with a root diskette system.
  417.      Then you can run fsck on your original root drive while it is not
  418.      mounted.
  419.  
  420.   o  Restore all or part of your original root drive from backup using
  421.      archive and compression utilities such as cpio, tar, gzip and
  422.      ftape.
  423.  
  424.  
  425.   We will describe how to build a compressed filesystem, so called
  426.   because it is compressed on disk and, when booted, is uncompressed
  427.   onto a ramdisk.  With a compressed filesystem you can fit many files
  428.   (approximately six megabytes) onto a standard 1440K diskette.  Because
  429.   the filesystem is much larger than a diskette, it cannot be built on
  430.   the diskette.  We have to build it elsewhere, compress it, then copy
  431.   it to the diskette.
  432.  
  433.  
  434.   4.2.  Creating the filesystem.
  435.  
  436.  
  437.   In order to build such a root filesystem, you need a spare device that
  438.   is large enough to hold all the files before compression.  You will
  439.   need a device capable of holding about four megabytes.  There are
  440.   several choices:
  441.  
  442.  
  443.   o  Use a ramdisk (DEVICE = /dev/ram0).  In this case, memory is used
  444.      to simulate a disk drive.  The ramdisk must be large enough to hold
  445.      a filesystem of the appropriate size.  If you use LILO, check your
  446.      configuration file (/etc/lilo.conf) for a line like:
  447.  
  448.  
  449.              RAMDISK_SIZE = nnn
  450.  
  451.  
  452.   which determines the maximum RAM that can be allocated to a ramdisk.
  453.   The default is 4096K, which should be sufficient.  You should probably
  454.   not try to use such a ramdisk on a machine with less than 8MB of RAM.
  455.  
  456.   Check to make sure you have a device like /dev/ram0, /dev/ram or
  457.   /dev/ramdisk.  If not, create /dev/ram0 with mknod (major number 1,
  458.   minor 0).
  459.  
  460.   o  If you have an unused hard disk partition that is large enough
  461.      (several megabytes), this is a good solution.
  462.  
  463.   o  Use a loopback device, which allows a disk file to be treated as a
  464.      device.  Using a loopback device you can create a three megabyte
  465.      file on your hard disk and build the filesystem on it.
  466.  
  467.      Type man losetup for instructions on using loopback devices.  If
  468.      you don't have losetup, you can get it along with compatible
  469.      versions of mount and unmount from the util-linux package in the
  470.      directory  <ftp://ftp.win.tue.nl/pub/linux/utils/util-linux/>.
  471.  
  472.  
  473.      If you do not have a loop device (/dev/loop0, /dev/loop1, etc.) on
  474.      your system, you will have to create one with ``mknod /dev/loop0 b
  475.      7 0''.  One you've installed these special mount and umount
  476.      binaries, create a temporary file on a hard disk with enough
  477.      capacity (eg, /tmp/fsfile).  You can use a command like
  478.  
  479.  
  480.   dd if=/dev/zero of=/tmp/fsfile bs=1k count=nnn
  481.  
  482.  
  483.   to create an nnn-block file.
  484.  
  485.   Use the file name in place of DEVICE below.  When you issue a mount
  486.   command you must include the option ``-o loop'' to tell mount to use a
  487.   loopback device.  For example:
  488.  
  489.           mount -o loop -t ext2 /tmp/fsfile /mnt
  490.  
  491.  
  492.  
  493.   will mount /tmp/fsfile (via a loopback device) at the mount point
  494.   /mnt.  A df will confirm this.
  495.  
  496.  
  497.  
  498.   After you've chosen one of these options, prepare the DEVICE with:
  499.  
  500.           dd if=/dev/zero of=DEVICE bs=1k count=3000
  501.  
  502.  
  503.  
  504.   This command zeroes out the device.  This step is important because
  505.   the filesystem on the device will be compressed later, so all unused
  506.   portions should be filled with zeroes to achieve maximum compression.
  507.  
  508.   Next, create the filesystem.  The Linux kernel recognizes two file
  509.   system types for root disks to be automatically copied to ramdisk.
  510.   These are minix and ext2, of which ext2 is the preferred file system.
  511.   If using ext2, you may find it useful to use the -i option to specify
  512.   more inodes than the default; -i 2000 is suggested so that you don't
  513.   run out of inodes.  Alternatively, you can save on inodes by removing
  514.   lots of unnecessary /dev files.  mke2fs will by default create 360
  515.   inodes on a 1.44Mb diskette.  I find that 120 inodes is ample on my
  516.   current rescue root diskette, but if you include all the devices in
  517.   the /dev directory then you will easily exceed 360.  Using a
  518.   compressed root filesystem allows a larger filesystem, and hence more
  519.   inodes by default, but you may still need to either reduce the number
  520.   of files or increase the number of inodes.
  521.  
  522.   So the command you use will look like:
  523.  
  524.           mke2fs -m 0 -i 2000 DEVICE
  525.  
  526.  
  527.  
  528.   (If you're using a loopback device, the disk file you're using should
  529.   be supplied in place of this DEVICE.  mke2fs may ask for
  530.   confirmation.)
  531.  
  532.   The mke2fs command will automatically detect the space available and
  533.   configure itself accordingly.  The -m 0 parameter prevents it from
  534.   reserving space for root, and hence provides more usable space on the
  535.   disk.
  536.  
  537.   Next, mount the device:
  538.  
  539.  
  540.           mount -t ext2 DEVICE /mnt
  541.  
  542.  
  543.  
  544.   (You must create a mount point /mnt if it does not already exist.)  In
  545.   the remaining sections, all destination directory names are assumed to
  546.   be relative to /mnt.
  547.  
  548.  
  549.  
  550.   4.3.  Populating the filesystem.
  551.  
  552.  
  553.   Here is a reasonable minimum set of directories for your root
  554.   filesystem:
  555.  
  556.  
  557.   o  /dev -- Devices, required to perform I/O
  558.  
  559.   o  /proc -- Directory stub required by the proc filesystem
  560.  
  561.   o  /etc -- System configuration files
  562.  
  563.   o  /sbin -- Critical system binaries
  564.  
  565.   o  /bin  -- Basic binaries considered part of the system
  566.  
  567.   o  /lib -- Shared libraries to provide run-time support
  568.  
  569.   o  /mnt -- A mount point for maintenance on other disks
  570.  
  571.   o  /usr -- Additional utilities and applications
  572.  
  573.   (The directory structure presented here is for root diskette use only.
  574.   Real Linux systems have a more complex and disciplined set of
  575.   policies, called the Filesystem Hierarchy Standard, for determining
  576.   where files should go.)
  577.  
  578.  
  579.   Three of these directories will be empty on the root filesystem, so
  580.   they only need to be created with mkdir.  The /proc directory is
  581.   basically a stub under which the proc filesystem is placed.  The
  582.   directories /mnt and /usr are only mount points for use after the
  583.   boot/root system is running.  Hence again, these directories only need
  584.   to be created.
  585.  
  586.   The remaining four directories are described in the following
  587.   sections.
  588.  
  589.  
  590.  
  591.   4.3.1.  /dev
  592.  
  593.  
  594.  
  595.   A /dev directory containing a special file for all devices to be used
  596.   by the system is mandatory for any Linux system.  The directory itself
  597.   is a normal directory, and can be created with mkdir in the normal
  598.   way.  The device special files, however, must be created in a special
  599.   way, using the mknod command.
  600.  
  601.   There is a shortcut, though -- copy your existing /dev directory
  602.   contents, and delete the ones you don't want.  The only requirement is
  603.   that you copy the device special files using -R option.  This will
  604.   copy the directory without attempting to copy the contents of the
  605.   files.  Be sure to use an upper case R.  If you use the lower case
  606.   switch -r, you will probably end up copying the entire contents of all
  607.   of your hard disks -- or at least as much of them as will fit on a
  608.   diskette!  Therefore, take care, and use the command:
  609.  
  610.           cp -dpR /dev /mnt
  611.  
  612.  
  613.  
  614.   assuming that the diskette is mounted at /mnt.  The dp switches ensure
  615.   that symbolic links are copied as links, rather than using the target
  616.   file, and that the original file attributes are preserved, thus
  617.   preserving ownership information.
  618.  
  619.   If you want to do it the hard way, use ls -l to display the major and
  620.   minor device numbers for the devices you want, and create them on the
  621.   diskette using mknod.
  622.  
  623.   However the devices are copied, it is worth checking that any special
  624.   devices you need have been placed on the rescue diskette.  For
  625.   example, ftape uses tape devices, so you will need to copy all of
  626.   these if you intend to access your floppy tape drive from the
  627.   bootdisk.
  628.  
  629.   Note that one inode is required for each device special file, and
  630.   inodes can at times be a scarce resource, especially on diskette
  631.   filesystems.  It therefore makes sense to remove any device special
  632.   files that you don't need from the diskette /dev directory.  Many
  633.   devices are obviously unnecessary on specific systems.  For example,
  634.   if you do not have SCSI disks you can safely remove all the device
  635.   files starting with sd.  Similarly, if you don't intend to use your
  636.   serial port then all device files starting with cua can go.
  637.  
  638.   Be sure to include the following files from this directory: console,
  639.   kmem, mem, null, ram, tty1.
  640.  
  641.  
  642.   4.3.2.  /etc
  643.  
  644.  
  645.   This directory must contain a number of configuration files.  On most
  646.   systems, these can be divided into three groups:
  647.  
  648.  
  649.   1. Required at all times, e.g. rc, fstab, passwd.
  650.  
  651.   2. May be required, but no-one is too sure.
  652.  
  653.   3. Junk that crept in.
  654.  
  655.   Files which are not essential can be identified with the command:
  656.  
  657.  
  658.  
  659.                ls -ltru
  660.  
  661.  
  662.  
  663.   This lists files in reverse order of date last accessed, so if any
  664.   files are not being accessed, they can be omitted from a root
  665.   diskette.
  666.  
  667.   On my root diskettes, I have the number of config files down to 15.
  668.   This reduces my work to dealing with three sets of files:
  669.  
  670.  
  671.   1. The ones I must configure for a boot/root system:
  672.  
  673.  
  674.  
  675.      a. rc.d/* -- system startup and run level change scripts
  676.  
  677.      b. fstab -- list of file systems to be mounted
  678.  
  679.      c. inittab -- parameters for the init process, the first process
  680.         started at boot time.
  681.  
  682.  
  683.   2. The ones I should tidy up for a boot/root system:
  684.  
  685.      a. passwd -- list of users, home directories, etc.
  686.  
  687.      b. group -- user groups.
  688.  
  689.      c. shadow -- passwords of users.  You may not have this.
  690.  
  691.      d. termcap -- the terminal capability database.
  692.  
  693.  
  694.      If security is important, passwd and shadow should be pruned to
  695.      avoid copying user passwords off the system, and so that when you
  696.      boot from diskette, unwanted logins are rejected.
  697.  
  698.      Be sure that passwd contains at least root.  If you intend other
  699.      users to login, be sure their home directories and shells exist.
  700.  
  701.      termcap, the terminal database, is typically several hundred kilo-
  702.      bytes.  The version on your boot/root diskette should be pruned
  703.      down to contain only the terminal(s) you use, which is usually just
  704.      the linux-console entry.
  705.  
  706.  
  707.   3. The rest. They work at the moment, so I leave them alone.
  708.  
  709.   Out of this, I only really have to configure two files, and what they
  710.   should contain is surprisingly small.
  711.  
  712.   o  rc should contain:
  713.  
  714.              #!/bin/sh
  715.              /bin/mount -av
  716.              /bin/hostname Kangaroo
  717.  
  718.  
  719.  
  720.   Be sure the directories are right.  You don't really need to run host-
  721.   name -- it just looks nicer if you do.
  722.  
  723.   o  fstab should contain at least:
  724.  
  725.  
  726.              /dev/ram0       /               ext2    defaults
  727.              /dev/fd0        /               ext2    defaults
  728.              /proc           /proc           proc    defaults
  729.  
  730.  
  731.  
  732.   You can copy entries from your existing fstab, but you should not
  733.   automatically mount any of your hard disk partitions; use the noauto
  734.   keyword with them.  Your hard disk may be damaged or dead when the
  735.   bootdisk is used.
  736.  
  737.   Your inittab should be changed so that its sysinit line runs rc or
  738.   whatever basic boot script will be used.  Also, if you want to ensure
  739.   that users on serial ports cannot login, comment out all the entries
  740.   for getty which include a ttys or ttyS device at the end of the line.
  741.   Leave in the tty ports so that you can login at the console.
  742.  
  743.   A minimal inittab file looks like this:
  744.  
  745.           id:2:initdefault:
  746.           si::sysinit:/etc/rc
  747.           1:2345:respawn:/sbin/getty 9600 tty1
  748.           2:23:respawn:/sbin/getty 9600 tty2
  749.  
  750.  
  751.  
  752.   The inittab file defines what the system will run in various states
  753.   including startup, move to multi-user mode, etc.  Be sure to check
  754.   carefully the filenames mentioned in inittab; if init cannot find the
  755.   program mentioned the bootdisk will hang, and you may not even get an
  756.   error message.
  757.  
  758.  
  759.   Note that some programs cannot be moved elsewhere because other
  760.   programs have hardcoded their locations.  For example on my system,
  761.   /etc/shutdown has hardcoded in it /etc/reboot.  If I move reboot to
  762.   /bin/reboot, and then issue a shutdown command, it will fail because
  763.   it cannot find the reboot file.
  764.  
  765.  
  766.   For the rest, just copy all the text files in your /etc directory,
  767.   plus all the executables in your /etc directory that you cannot be
  768.   sure you do not need.  As a guide, consult the sample listing in
  769.   Section ``Sample rootdisk directory listings''.  Probably it will
  770.   suffice to copy only those files, but systems differ a great deal, so
  771.   you cannot be sure that the same set of files on your system is
  772.   equivalent to the files in the list.  The only sure method is to start
  773.   with inittab and work out what is required.
  774.  
  775.   Most systems now use an /etc/rc.d/ directory containing shell scripts
  776.   for different run levels.  The minimum is a single rc script, but it
  777.   may be simpler just to copy inittab and the /etc/rc.d directory from
  778.   your existing system, and prune the shell scripts in the rc.d
  779.   directory to remove processing not relevent to a diskette system
  780.   environment.
  781.  
  782.  
  783.   4.3.3.  /bin and /sbin
  784.  
  785.  
  786.   The /bin directory is a convenient place for extra utilities you need
  787.   to perform basic operations, utilities such as ls, mv, cat and dd.
  788.   See Appendix ``Sample rootdisk directory listings'' for an example
  789.   list of files that go in a /bin and /sbin directories.  It does not
  790.   include any of the utilities required to restore from backup, such as
  791.   cpio, tar and gzip.  That is because I place these on a separate
  792.   utility diskette, to save space on the boot/root diskette.  Once the
  793.   boot/root diskette is booted, it is copied to the ramdisk leaving the
  794.   diskette drive free to mount another diskette, the utility diskette.
  795.   I usually mount this as /usr.
  796.  
  797.   Creation of a utility diskette is described below in the section
  798.   Section ``Building a utility disk''.  It is probably desirable to
  799.   maintain a copy of the same version of backup utilities used to write
  800.   the backups so you don't waste time trying to install versions that
  801.   cannot read your backup tapes.
  802.  
  803.   Make sure you include the following programs: init, getty or
  804.   equivalent, login, mount, some shell capable of running your rc
  805.   scripts, a link from sh to the shell.
  806.  
  807.   4.3.4.  /lib
  808.  
  809.  
  810.   In /lib you place necessary shared libraries and loaders.  If the
  811.   necessary libraries are not found in your /lib directory then the
  812.   system will be unable to boot.  If you're lucky you may see an error
  813.   message telling you why.
  814.  
  815.   Nearly every program requires at least the libc library, libc.so.N,
  816.   where N is the current version number.  Check your /lib directory.
  817.   libc.so.N is usually a symlink to a filename with a complete version
  818.   number:
  819.  
  820.  
  821.  
  822.        % ls -l /lib/libc*
  823.        -rwxr-xr-x   1 root     root      4016683 Apr 16 18:48 libc-2.1.1.so*
  824.        lrwxrwxrwx   1 root     root           13 Apr 10 12:25 libc.so.6 -> libc-2.1.1.so*
  825.  
  826.  
  827.  
  828.   In this case, you want libc-2.1.1.so.  To find other libraries you
  829.   should go through all the binaries you plan to include and check their
  830.   dependencies with the ldd command.  For example:
  831.  
  832.  
  833.           % ldd /sbin/mke2fs
  834.           libext2fs.so.2 => /lib/libext2fs.so.2 (0x40014000)
  835.           libcom_err.so.2 => /lib/libcom_err.so.2 (0x40026000)
  836.           libuuid.so.1 => /lib/libuuid.so.1 (0x40028000)
  837.           libc.so.6 => /lib/libc.so.6 (0x4002c000)
  838.           /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
  839.  
  840.  
  841.  
  842.   Each file on the right-hand side is required.  The file may be a
  843.   symbolic link.
  844.  
  845.   Note that some libraries are quite large and will not fit easily on
  846.   your root filesystem.  For example, the libc.so listed above is about
  847.   4 meg.  You will probably need to strip libraries when copying them to
  848.   your root filesystem.  See Section ``Reducing root filesystem size''
  849.   for instructions.
  850.  
  851.  
  852.   In /lib you must also include a loader for the libraries.  The loader
  853.   will be either ld.so (for a.out libraries) or ld-linux.so (for ELF
  854.   libraries).  Newer versions of ldd tell you exactly which loader is
  855.   needed, as in the example above, but older versions may not.  If
  856.   you're unsure which you need, run the file command on the library.
  857.   For example:
  858.  
  859.  
  860.           % file/lib/libc.so.4.7.2 /lib/libc.so.5.4.33 /lib/libc-2.1.1.so
  861.           /lib/libc.so.4.7.2: Linux/i386 demand-paged executable (QMAGIC), stripped
  862.           /lib/libc.so.5.4.33: ELF 32-bit LSB shared object, Intel 80386, version 1, stripped
  863.           /lib/libc-2.1.1.so: ELF 32-bit LSB shared object, Intel 80386, version 1, not stripped
  864.  
  865.  
  866.  
  867.   The QMAGIC indicates that 4.7.2 is for a.out libraries, and ELF
  868.   indicates that 5.4.33 and 2.1.1 are for ELF.
  869.  
  870.   Copy the specific loader(s) you need to the root filesystem you're
  871.   building.  Libraries and loaders should be checked carefully against
  872.   the included binaries.  If the kernel cannot load a necessary library,
  873.   the kernel will usually hang with no error message.
  874.  
  875.  
  876.  
  877.   4.4.  Providing for PAM and NSS.
  878.  
  879.  
  880.   Your system may require dynamically loaded libraries that are not
  881.   visible to ldd.
  882.  
  883.  
  884.   4.4.1.  PAM (Pluggable Authentication Modules).
  885.  
  886.  
  887.   If your system uses PAM (Pluggable Authentication Modules), you must
  888.   make some provision for it on your bootdisk or you will not be able to
  889.   login.  PAM, briefly, is a sophisticated modular method for
  890.   authenticating users and controlling their access to services.  An
  891.   easy way to determine if your system uses PAM is to check your hard
  892.   disks's /etc directory for a file pam.conf or a pam.d directory; if
  893.   either exists, you must provide some minimal PAM support.
  894.   (Alternatively, run ldd on your login executable; if the output
  895.   includes libpam.so, you need PAM.)
  896.  
  897.   Fortunately, security is usually of no concern with bootdisks since
  898.   anyone who has physical access to a machine can usually do anything
  899.   they want anyway.  Therefore, you can effectively disable PAM by
  900.   creating a simple /etc/pam.conf file in your root filesystem that
  901.   looks like this:
  902.  
  903.  
  904.   ______________________________________________________________________
  905.   OTHER   auth       optional     /lib/security/pam_permit.so
  906.   OTHER   account    optional     /lib/security/pam_permit.so
  907.   OTHER   password   optional     /lib/security/pam_permit.so
  908.   OTHER   session    optional     /lib/security/pam_permit.so
  909.   ______________________________________________________________________
  910.  
  911.  
  912.  
  913.   Also copy the file /lib/security/pam_permit.so to your root
  914.   filesystem.  This library is only about 8K so it imposes minimal
  915.   overhead.
  916.  
  917.   Note that this configuration allows anyone complete access to the
  918.   files and services on your machine.  If you care about security on
  919.   your bootdisk for some reason, you'll have to copy some or all of your
  920.   hard disk's PAM setup to your root filesystem.  Be sure to read the
  921.   PAM documentation carefully, and copy any libraries needed in
  922.   /lib/security onto your root filesystem.
  923.  
  924.   You must also include /lib/libpam.so on your bootdisk.  But you
  925.   already know this since you ran ldd on /bin/login, which showed this
  926.   dependency.
  927.  
  928.  
  929.  
  930.   4.4.2.  NSS (Name Service Switch).
  931.  
  932.  
  933.   If you are using glibc (aka libc6), you will have to make provisions
  934.   for name services or you will not be able to log in.  The file
  935.   /etc/nsswitch.conf controls database lookups for various servies.  If
  936.   you don't plan to access services from the network (eg, DNS or NIS
  937.   lookups), you need only prepare a simple nsswitch.conf file that looks
  938.   like this:
  939.  
  940.  
  941.   ______________________________________________________________________
  942.        passwd:     files
  943.        shadow:     files
  944.        group:      files
  945.        hosts:      files
  946.        services:   files
  947.        networks:   files
  948.        protocols:  files
  949.        rpc:        files
  950.        ethers:     files
  951.        netmasks:   files
  952.        bootparams: files
  953.        automount:  files
  954.        aliases:    files
  955.        netgroup:   files
  956.        publickey:  files
  957.   ______________________________________________________________________
  958.  
  959.  
  960.  
  961.   This specifies that every service be provided only by local files.
  962.   You will also need to include /lib/libnss_files.so.1, which will be
  963.   loaded dynamically to handle the file lookups.
  964.  
  965.   If you plan to access the network from your bootdisk, you may want to
  966.   create a more elaborate nsswitch.conf file.  See the nsswitch man page
  967.   for details.  Keep in mind that you must include a file
  968.   /lib/libnss_service.so.1 for each service you specify.
  969.  
  970.  
  971.  
  972.   4.5.  Modules.
  973.  
  974.  
  975.  
  976.   If you have a modular kernel, you must consider which modules you may
  977.   want to load from your bootdisk after booting.  You might want to
  978.   include ftape and zftape modules if your backup tapes are on floppy
  979.   tape, modules for SCSI devices if you have them, and possibly modules
  980.   for PPP or SLIP support if you want to access the net in an emergency.
  981.  
  982.   These modules may be placed in /lib/modules.  You should also include
  983.   insmod, rmmod and lsmod.  Depending on whether you want to load
  984.   modules automatically, you might also include modprobe, depmod and
  985.   swapout.  If you use kerneld, include it along with /etc/conf.modules.
  986.  
  987.   However, the main advantage to using modules is that you can move non-
  988.   critical modules to a utility disk and load them when needed, thus
  989.   using less space on your root disk.  If you may have to deal with many
  990.   different devices, this approach is preferable to building one huge
  991.   kernel with many drivers built in.
  992.  
  993.   Note that in order to boot a compressed ext2 filesystem, you must have
  994.   ramdisk and ext2 support built-in.  They cannot be supplied as
  995.   modules.
  996.  
  997.  
  998.  
  999.   4.6.  Some final details.
  1000.  
  1001.  
  1002.   Some system programs, such as login, complain if the file
  1003.   /var/run/utmp and the directory /var/log do not exist.
  1004.           mkdir -p /mnt/var/{log,run}
  1005.           touch /mnt/var/run/utmp
  1006.  
  1007.  
  1008.  
  1009.   Finally, after you have set up all the libraries you need, run
  1010.   ldconfig to remake /etc/ld.so.cache on the root filesystem.  The cache
  1011.   tells the loader where to find the libraries.  To remake ld.so.cache,
  1012.   issue the following commands:
  1013.  
  1014.  
  1015.           chdir /mnt; chroot /mnt /sbin/ldconfig
  1016.  
  1017.  
  1018.  
  1019.   The chroot is necessary because ldconfig always remakes the cache for
  1020.   the root filesystem.
  1021.  
  1022.  
  1023.   4.7.  Wrapping it up.
  1024.  
  1025.  
  1026.   Once you have finished constructing the root filesystem, unmount it,
  1027.   copy it to a file and compress it:
  1028.  
  1029.  
  1030.           umount /mnt
  1031.           dd if=DEVICE bs=1k | gzip -v9 > rootfs.gz
  1032.  
  1033.  
  1034.  
  1035.   When this finishes you will have a file rootfs.gz that is your
  1036.   compressed root filesystem.  You should check its size to make sure it
  1037.   will fit on a diskette; if it doesn't you'll have to go back and
  1038.   remove some files.  Section ``Reducing root filesystem size'' has some
  1039.   hints for reducing the size of the root filesystem.
  1040.  
  1041.  
  1042.  
  1043.   5.  Choosing a kernel.
  1044.  
  1045.  
  1046.   At this point you have a complete compressed root filesystem.  The
  1047.   next step is to build or select a kernel.  In most cases it would be
  1048.   possible to copy your current kernel and boot the diskette from that.
  1049.   However, there may be cases where you wish to build a separate one.
  1050.  
  1051.   One reason is size.  If you are building a single boot/root diskette,
  1052.   the kernel will be one of the largest files on the diskette so you
  1053.   will have to reduce the size of the kernel as much as possible.  To
  1054.   reduce kernel size, build it with the minumum set of facilities
  1055.   necessary to support the desired system.  This means leaving out
  1056.   everything you don't need.  Networking is a good thing to leave out,
  1057.   as well as support for any disk drives and other devices which you
  1058.   don't need when running your boot/root system.  As stated before, your
  1059.   kernel must have ramdisk and ext2 support built into it.
  1060.  
  1061.   Having worked out a minimum set of facilities to include in a kernel,
  1062.   you then need to work out what to add back in.  Probably the most
  1063.   common uses for a boot/root diskette system would be to examine and
  1064.   restore a corrupted root file system, and to do this you may need
  1065.   kernel support.  For example, if your backups are all held on tape
  1066.   using Ftape to access your tape drive, then, if you lose your current
  1067.   root drive and drives containing Ftape, then you will not be able to
  1068.   restore from your backup tapes.  You will have to reinstall Linux,
  1069.   download and reinstall ftape, and then try to read your backups.
  1070.   The point here is that, whatever I/O support you have added to your
  1071.   kernel to support backups should also be added into your boot/root
  1072.   kernel.
  1073.  
  1074.  
  1075.   The procedure for actually building the kernel is described in the
  1076.   documentation that comes with the kernel.  It is quite easy to follow,
  1077.   so start by looking in /usr/src/linux.  If you have trouble building a
  1078.   kernel, you should probably not attempt to build boot/root systems
  1079.   anyway.  Remember to compress the kernel with ``make zImage''.
  1080.  
  1081.  
  1082.  
  1083.   6.  Putting them together: Making the diskette(s).
  1084.  
  1085.  
  1086.   At this point you have a kernel and a compressed root filesystem.  If
  1087.   you are making a boot/root disk, check their sizes to make sure they
  1088.   will both fit on one disk.  If you are making a two disk boot+root
  1089.   set, check the root filesystem to make sure it will fit on a single
  1090.   diskette.
  1091.  
  1092.   You should decide whether to use LILO to boot the bootdisk kernel.
  1093.   The alternative is to copy the kernel directly to the diskette and
  1094.   boot without LILO.  The advantage of using LILO is that it enables you
  1095.   to supply some parameters to the kernel which may be necessary to
  1096.   initialize your hardware (Check the file /etc/lilo.conf on your
  1097.   system.  If it exists and has a line like ``append=...'', you probably
  1098.   need this feature).  The disadvantage of using LILO is that building
  1099.   the bootdisk is more complicated and takes slightly more space.  You
  1100.   will have to set up a small separate filesystem, which we shall call
  1101.   the kernel filesystem, where you transfer the kernel and a few other
  1102.   files that LILO needs.
  1103.  
  1104.  
  1105.   If you are going to use LILO, read on; if you are going to transfer
  1106.   the kernel directly, skip ahead to section ``Without using LILO''.
  1107.  
  1108.  
  1109.   6.1.  Transferring the kernel with LILO
  1110.  
  1111.  
  1112.   The first thing you must do is create a small configuration file for
  1113.   LILO.  It should look like this:
  1114.  
  1115.  
  1116.   ______________________________________________________________________
  1117.           boot      =/dev/fd0
  1118.           install   =/boot/boot.b
  1119.           map       =/boot/map
  1120.           read-write
  1121.           backup    =/dev/null
  1122.           compact
  1123.           image     = KERNEL
  1124.           label     = Bootdisk
  1125.           root      =/dev/fd0
  1126.   ______________________________________________________________________
  1127.  
  1128.  
  1129.  
  1130.   For an explanation of these parameters, see LILO's user documentation.
  1131.   You will probably also want to add an append=... line to this file
  1132.   from your hard disk's /etc/lilo.conf file.
  1133.  
  1134.   Save this file as bdlilo.conf.
  1135.  
  1136.   You now have to create a small filesystem, which we shall call a
  1137.   kernel filesystem, to distinguish it from the root filesystem.
  1138.  
  1139.   First, figure out how large the filesystem should be.  Take the size
  1140.   of your kernel in blocks (the size shown by ``ls -l KERNEL'' divided
  1141.   by 1024 and rounded up) and add 50.  Fifty blocks is approximately the
  1142.   space needed for inodes plus other files.  You can calculate this
  1143.   number exactly if you want to, or just use 50.  If you're creating a
  1144.   two-disk set, you may as well overestimate the space since the first
  1145.   disk is only used for the kernel anyway.  Call this number
  1146.   KERNEL_BLOCKS.
  1147.  
  1148.   Put a floppy diskette in the drive (for simplicity we'll assume
  1149.   /dev/fd0) and create an ext2 kernel filesystem on it:
  1150.  
  1151.  
  1152.           mke2fs -i 8192 -m 0 /dev/fd0 KERNEL_BLOCKS
  1153.  
  1154.  
  1155.  
  1156.   The ``-i 8192'' specifies that we want one inode per 8192 bytes.
  1157.   Next, mount the filesystem, remove the lost+found directory, and
  1158.   create dev and boot directories for LILO:
  1159.  
  1160.  
  1161.           mount /dev/fd0 /mnt
  1162.           rm -rf /mnt/lost+found
  1163.           mkdir /mnt/{boot,dev}
  1164.  
  1165.  
  1166.  
  1167.   Next, create devices /dev/null and /dev/fd0.  Instead of looking up
  1168.   the device numbers, you can just copy them from your hard disk using
  1169.   -R:
  1170.  
  1171.  
  1172.           cp -R /dev/{null,fd0} /mnt/dev
  1173.  
  1174.  
  1175.  
  1176.   LILO needs a copy of its boot loader, boot.b, which you can take from
  1177.   your hard disk.  It is usually kept in the /boot directory.
  1178.  
  1179.  
  1180.           cp /boot/boot.b /mnt/boot
  1181.  
  1182.  
  1183.  
  1184.   Finally, copy in the LILO configuration file you created in the last
  1185.   section, along with your kernel.  Both can be put in the root
  1186.   directory:
  1187.  
  1188.  
  1189.           cp bdlilo.conf KERNEL /mnt
  1190.  
  1191.  
  1192.  
  1193.   Everything LILO needs is now on the kernel filesystem, so you are
  1194.   ready to run it.  LILO's -r flag is used for installing the boot
  1195.   loader on some other root:
  1196.  
  1197.  
  1198.           lilo -v -C bdlilo.conf -r /mnt
  1199.  
  1200.  
  1201.   LILO should run without error, after which the kernel filesystem
  1202.   should look something like this:
  1203.  
  1204.  
  1205.   ______________________________________________________________________
  1206.   total 361
  1207.     1 -rw-r--r--   1 root     root          176 Jan 10 07:22 bdlilo.conf
  1208.     1 drwxr-xr-x   2 root     root         1024 Jan 10 07:23 boot/
  1209.     1 drwxr-xr-x   2 root     root         1024 Jan 10 07:22 dev/
  1210.   358 -rw-r--r--   1 root     root       362707 Jan 10 07:23 vmlinuz
  1211.   boot:
  1212.   total 8
  1213.     4 -rw-r--r--   1 root     root         3708 Jan 10 07:22 boot.b
  1214.     4 -rw-------   1 root     root         3584 Jan 10 07:23 map
  1215.   dev:
  1216.   total 0
  1217.     0 brw-r-----   1 root     root       2,   0 Jan 10 07:22 fd0
  1218.     0 crw-r--r--   1 root     root       1,   3 Jan 10 07:22 null
  1219.   ______________________________________________________________________
  1220.  
  1221.  
  1222.  
  1223.   Do not worry if the file sizes are slightly different from yours.
  1224.  
  1225.   Now leave the disk in the drive and go to section ``Setting the
  1226.   ramdisk word''.
  1227.  
  1228.  
  1229.   6.2.  Transferring the kernel without LILO.
  1230.  
  1231.  
  1232.   If you are not using LILO, transfer the kernel to the bootdisk with
  1233.   the dd command:
  1234.  
  1235.  
  1236.           % dd if=KERNEL of=/dev/fd0 bs=1k
  1237.           353+1 records in
  1238.           353+1 records out
  1239.  
  1240.  
  1241.  
  1242.   In this example, dd wrote 353 complete records + 1 partial record, so
  1243.   the kernel occupies the first 354 blocks of the diskette.  Call this
  1244.   number KERNEL_BLOCKS and remember it for use in the next section.
  1245.  
  1246.   Finally, set the root device to be the diskette itself, then set the
  1247.   root to be loaded read/write:
  1248.  
  1249.  
  1250.           rdev /dev/fd0 /dev/fd0
  1251.           rdev -R /dev/fd0 0
  1252.  
  1253.  
  1254.  
  1255.   Be careful to use a capital -R in the second rdev command.
  1256.  
  1257.  
  1258.  
  1259.   6.3.  Setting the ramdisk word.
  1260.  
  1261.  
  1262.   Inside the kernel image is the ramdisk word that specifies where the
  1263.   root filesystem is to be found, along with other options.  The word
  1264.   can be accessed and set via the rdev command, and its contents are
  1265.   interpreted as follows:
  1266.  
  1267.  
  1268.           bits  0-10:     Offset to start of ramdisk, in 1024 byte blocks
  1269.           bits 11-13:     unused
  1270.           bit     14:     Flag indicating that ramdisk is to be loaded
  1271.           bit     15:     Flag indicating to prompt before loading rootfs
  1272.  
  1273.  
  1274.  
  1275.   If bit 15 is set, on boot-up you will be prompted to place a new
  1276.   floppy diskette in the drive.  This is necessary for a two-disk boot
  1277.   set.
  1278.  
  1279.   There are two cases, depending on whether you are building a single
  1280.   boot/root diskette or a double ``boot+root'' diskette set.
  1281.  
  1282.  
  1283.   1. If you are building a single disk, the compressed root filesystem
  1284.      will be placed right after the kernel, so the offset will be the
  1285.      first free block (which should be the same as KERNEL_BLOCKS).  Bit
  1286.      14 will be set to 1, and bit 15 will be zero.
  1287.  
  1288.      For example, say you're building a single disk and the root
  1289.      filesystem will begin at block 253 (decimal).  The ramdisk word
  1290.      value should be 253 (decimal) with bit 14 set to 1 and bit 15 set
  1291.      to 0.  To calculate the value you can simply add the decimal
  1292.      values.  253 + (2^14) = 253 + 16384 = 16637.  If you don't quite
  1293.      understand where this number comes from, plug it into a scientific
  1294.      calculator and convert it to binary,
  1295.  
  1296.   2. If you are building a two-disk set, the root filesystem will begin
  1297.      at block zero of the second disk, so the offset will be zero.  Bit
  1298.      14 will be set to 1 and bit 15 will be 1.  The decimal value will
  1299.      be 2^14 + 2^15 = 49152 in this case.
  1300.  
  1301.  
  1302.  
  1303.   After carefully calculating the value for the ramdisk word, set it
  1304.   with rdev -r.  Be sure to use the decimal value.  If you used LILO,
  1305.   the argument to rdev here should be the mounted kernel path, e.g.
  1306.   /mnt/vmlinuz; if you copied the kernel with dd, instead use the floppy
  1307.   device name (e.g., /dev/fd0).
  1308.  
  1309.  
  1310.           rdev -r KERNEL_OR_FLOPPY_DRIVE  VALUE
  1311.  
  1312.  
  1313.  
  1314.   If you used LILO, unmount the diskette now.
  1315.  
  1316.  
  1317.  
  1318.   6.4.  Transferring the root filesystem.
  1319.  
  1320.  
  1321.   The last step is to transfer the root filesystem.
  1322.  
  1323.  
  1324.   o  If the root filesystem will be placed on the same disk as the
  1325.      kernel, transfer it using dd with the seek option, which specifies
  1326.      how many blocks to skip:
  1327.  
  1328.  
  1329.  
  1330.              dd if=rootfs.gz of=/dev/fd0 bs=1k seek=KERNEL_BLOCKS
  1331.  
  1332.  
  1333.  
  1334.   o  If the root filesystem will be placed on a second disk, remove the
  1335.      first diskette, put the second diskette in the drive, then transfer
  1336.      the root filesystem to it:
  1337.  
  1338.  
  1339.              dd if=rootfs.gz of=/dev/fd0 bs=1k
  1340.  
  1341.  
  1342.  
  1343.   Congratulations, you are done!  You should always test a bootdisk
  1344.   before putting it aside for an emergency! If it fails to boot, read
  1345.   on.
  1346.  
  1347.  
  1348.  
  1349.   7.  Troubleshooting, or The Agony of Defeat.
  1350.  
  1351.  
  1352.  
  1353.   When building bootdisks, the first few tries often will not boot.  The
  1354.   general approach to building a root disk is to assemble components
  1355.   from your existing system, and try and get the diskette-based system
  1356.   to the point where it displays messages on the console.  Once it
  1357.   starts talking to you, the battle is half over because you can see
  1358.   what it is complaining about, and you can fix individual problems
  1359.   until the system works smoothly.  If the system just hangs with no
  1360.   explanation, finding the cause can be difficult.  To get a system to
  1361.   boot to the stage where it will talk to you requires several
  1362.   components to be present and correctly configured.  The recommended
  1363.   procedure for investigating the problem where the system will not talk
  1364.   to you is as follows:
  1365.  
  1366.  
  1367.   o  You may see a message like this:
  1368.  
  1369.  
  1370.      Kernel panic: VFS: Unable to mount root fs on XX:YY
  1371.  
  1372.  
  1373.  
  1374.   This is a common problem and it has only a few causes.  First, check
  1375.   the device XX:YY against the list of device codes; is it the correct
  1376.   root device?  If not, you probably didn't do an rdev -R, or you did it
  1377.   on the wrong image.  If the device code is correct, then check care-
  1378.   fully the device drivers compiled into your kernel.  Make sure it has
  1379.   floppy disk, ramdisk and ext2 filesystem support built-in.
  1380.  
  1381.   o  Check that the root disk actually contains the directories you
  1382.      think it does.  It is easy to copy at the wrong level so that you
  1383.      end up with something like /rootdisk/bin instead of /bin on your
  1384.      root diskette.
  1385.  
  1386.   o  Check that there is a /lib/libc.so with the same link that appears
  1387.      in your /lib directory on your hard disk.
  1388.  
  1389.   o  Check that any symbolic links in your /dev directory in your
  1390.      existing system also exist on your root diskette filesystem, where
  1391.      those links are to devices which you have included in your root
  1392.      diskette. In particular, /dev/console links are essential in many
  1393.      cases.
  1394.  
  1395.  
  1396.   o  Check that you have included /dev/tty1, /dev/null, /dev/zero,
  1397.      /dev/mem, /dev/ram and /dev/kmem files.
  1398.  
  1399.   o  Check your kernel configuration -- support for all resources
  1400.      required up to login point must be built in, not modules.  So
  1401.      ramdisk and ext2 support must be built-in.
  1402.  
  1403.   o  Check that your kernel root device and ramdisk settings are
  1404.      correct.
  1405.  
  1406.   Once these general aspects have been covered, here are some more
  1407.   specific files to check:
  1408.  
  1409.  
  1410.   1. Make sure init is included as /sbin/init or /bin/init.  Make sure
  1411.      it is executable.
  1412.  
  1413.   2. Run ldd init to check init's libraries.  Usually this is just
  1414.      libc.so, but check anyway.  Make sure you included the necessary
  1415.      libraries and loaders.
  1416.  
  1417.   3. Make sure you have the right loader for your libraries -- ld.so for
  1418.      a.out or ld-linux.so for ELF.
  1419.  
  1420.   4. Check the /etc/inittab on your bootdisk filesystem for the calls to
  1421.      getty (or some getty-like program, such as agetty, mgetty or
  1422.      getty_ps).  your hard disk inittab.  Check the man pages of the
  1423.      program you use to make sure these make sense.  inittab is possibly
  1424.      the trickiest part because its syntax and content depend on the
  1425.      init program used and the nature of the system.  The only way to
  1426.      tackle it is to read the man pages for init and inittab and work
  1427.      out exactly what your existing system is doing when it boots.
  1428.      Check to make sure /etc/inittab has a system initialisation entry.
  1429.      This should contain a command to execute the system initialization
  1430.      script, which must exist.
  1431.  
  1432.   5. As with init, run ldd on your getty to see what it needs, and make
  1433.      sure the necessary library files and loaders were included in your
  1434.      root filesystem.
  1435.  
  1436.   6. Be sure you have included a shell program (e.g., bash or ash)
  1437.      capable of running all of your rc scripts.
  1438.  
  1439.   7. If you have a /etc/ld.so.cache file on your rescue disk, remake it.
  1440.  
  1441.  
  1442.  
  1443.   If init starts, but you get a message like:
  1444.  
  1445.           Id xxx respawning too fast: disabled for 5 minutes
  1446.  
  1447.  
  1448.  
  1449.   it is coming from init, usually indicating that getty or login is
  1450.   dying as soon as it starts up.  executables and the libraries they
  1451.   depend upon.  Make sure the invocations in /etc/inittab are correct.
  1452.   If you get strange messages from getty, it may mean the calling form
  1453.   in /etc/inittab is wrong.  The options of the getty programs are
  1454.   variable; even different versions of agetty are reported to have
  1455.   different incompatible calling forms.
  1456.  
  1457.   If you get a login prompt, and you enter a valid login name but the
  1458.   system prompts you for another login name immediately, the problem may
  1459.   be with PAM or NSS.  See Section ``PAM and NSS''.  The problem may
  1460.   also be that you use shadow passwords and didn't copy /etc/shadow to
  1461.   your bootdisk.
  1462.  
  1463.   If you try to run some executable, such as df, which is on your rescue
  1464.   disk but you yields a message like: df: not found, check two things:
  1465.   (1) Make sure the directory containing the binary is in your PATH, and
  1466.   (2) make sure you have libraries (and loaders) the program needs.
  1467.  
  1468.  
  1469.  
  1470.   8.  Miscellaneous topics.
  1471.  
  1472.  
  1473.  
  1474.   8.1.  Reducing root filesystem size.
  1475.  
  1476.  
  1477.   Sometimes a root filesystem is too large to fit on a diskette even
  1478.   after compression.  Here are some ways to reduce the filesystem size,
  1479.   listed in decreasing order of effectiveness:
  1480.  
  1481.  
  1482.  
  1483.      Increase the disk density
  1484.         By default, floppy diskettes are formatted at 1440K, but higher
  1485.         density formats are available.  fdformat will format disks for
  1486.         the following sizes: 1600, 1680, 1722, 1743, 1760, 1840, and
  1487.         1920.  Most 1440K drives will support 1722K, and this is what I
  1488.         always use for bootdisks.  See the fdformat man page and
  1489.         /usr/src/linux/Documentation/devices.txt.
  1490.  
  1491.  
  1492.      Replace your shell
  1493.         Some of the popular shells for Linux, such as bash and tcsh, are
  1494.         large and require many libraries.  Light-weight alternatives
  1495.         exist, such as ash, lsh, kiss and smash, which are much smaller
  1496.         and require few (or no) libraries.  Most of these replacement
  1497.         shells are available from
  1498.         <http://metalab.unc.edu/pub/Linux/system/shells/>.  Make sure
  1499.         any shell you use is capable of running commands in all the rc
  1500.         files you include on your bootdisk.
  1501.  
  1502.  
  1503.      Strip libraries and binaries
  1504.  
  1505.         Many libraries and binaries are typically unstripped (include
  1506.         debugging symbols).  Running 'file' on these files will tell you
  1507.         'not stripped' if so.  When copying binaries to your root
  1508.         filesystem, it is good practice to use:
  1509.  
  1510.  
  1511.                 objcopy --strip-all FROM TO
  1512.  
  1513.  
  1514.  
  1515.      When copying libraries, use:
  1516.  
  1517.  
  1518.              objcopy --strip-debug FROM TO
  1519.  
  1520.  
  1521.  
  1522.      Move non-critical files to a utility disk
  1523.         If some of your binaries are not needed immediately to boot or
  1524.         login, you can move them to a utility disk.  See section
  1525.         ``Building a utility disk'' for details.  You may also consider
  1526.         moving modules to a utility disk as well.
  1527.  
  1528.  
  1529.  
  1530.   8.2.  Non-ramdisk root filesystems.
  1531.  
  1532.  
  1533.  
  1534.   Section ``Building a root filesystem'' gave instructions for building
  1535.   a compressed root filesystem which is loaded to ramdisk when the
  1536.   system boots.  This method has many advantages so it is commonly used.
  1537.   However, some systems with little memory cannot afford the RAM needed
  1538.   for this, and they must use root filesystems mounted directly from the
  1539.   diskette.
  1540.  
  1541.   Such filesystems are actually easier to build than compressed root
  1542.   filesystems because they can be built on a diskette rather than on
  1543.   some other device, and they do not have to be compressed.  We will
  1544.   outline the procedure as it differs from the instructions above.  If
  1545.   you choose to do this, keep in mind that you will have much less space
  1546.   available.
  1547.  
  1548.  
  1549.   1. Calculate how much space you will have available for root files.
  1550.  
  1551.      If you are building a single boot/root disk, you must fit all
  1552.      blocks for the kernel plus all blocks for the root filesystem on
  1553.      the one disk.
  1554.  
  1555.   2. Using mke2fs, create a root filesystem on a diskette of the
  1556.      appropriate size.
  1557.  
  1558.   3. Populate the filesystem as described above.
  1559.  
  1560.   4. When done, unmount the filesystem and transfer it to a disk file
  1561.      but do not compress it.
  1562.  
  1563.   5. Transfer the kernel to a floppy diskette, as described above.  When
  1564.      calculating the ramdisk word, set bit 14 to zero, to indicate that
  1565.      the root filesystem is not to be loaded to ramdisk.  Run the rdev's
  1566.      as described.
  1567.  
  1568.   6. Transfer the root filesystem as before.
  1569.  
  1570.   There are several shortcuts you can take.  If you are building a two-
  1571.   disk set, you can build the complete root filesystem directly on the
  1572.   second disk and you need not transfer it to a hard disk file and then
  1573.   back.  Also, if you are building a single boot/root disk and using
  1574.   LILO, you can build a single filesystem on the entire disk, containing
  1575.   the kernel, LILO files and root files, and simply run LILO as the last
  1576.   step.
  1577.  
  1578.  
  1579.  
  1580.   8.3.  Building a utility disk.
  1581.  
  1582.  
  1583.  
  1584.   Building a utility disk is relatively easy -- simply create a
  1585.   filesystem on a formatted disk and copy files to it.  To use it with a
  1586.   bootdisk, mount it manually after the system is booted.
  1587.  
  1588.   In the instructions above, we mentioned that the utility disk could be
  1589.   mounted as /usr.  In this case, binaries could be placed into a /bin
  1590.   directory on your utility disk, so that placing /usr/bin in your path
  1591.   will access them.  Additional libraries needed by the binaries are
  1592.   placed in /lib on the utility disk.
  1593.  
  1594.   There are several important points to keep in mind when designing a
  1595.   utility disk:
  1596.  
  1597.  
  1598.   1. Do not place critical system binaries or libraries onto the utility
  1599.      disk, since it will not be mountable until after the system has
  1600.      booted.
  1601.  
  1602.   2. You cannot access a floppy diskette and a floppy tape drive
  1603.      simultaneously.  This means that if you have a floppy tape drive,
  1604.      you will not be able to access it while your utility disk is
  1605.      mounted.
  1606.  
  1607.   3. Access to files on the utility disk will be slow.
  1608.  
  1609.   Appendix ``Sample utility disk directory listing'' shows a sample of
  1610.   files on a utility disk.  Here are some ideas for files you may find
  1611.   useful: programs for examining and manipulating disks (format, fdisk)
  1612.   and filesystems (mke2fs, fsck, debugfs, isofs.o), a lightweight text
  1613.   editor (elvis, jove), compression and archive utilities (gzip, tar,
  1614.   cpio, afio), tape utilities (mt, tob, taper), communications utilities
  1615.   (ppp.o, slip.o, minicom) and utilities for devices (setserial, mknod).
  1616.  
  1617.  
  1618.   9.  How the pros do it.
  1619.  
  1620.  
  1621.   You may notice that the bootdisks used by major distributions such as
  1622.   Slackware, RedHat or Debian seem more sophisticated than what is
  1623.   described in this document.  Professional distribution bootdisks are
  1624.   based on the same principles outlined here, but employ various tricks
  1625.   because their bootdisks have additional requirements.  First, they
  1626.   must be able to work with a wide variety of hardware, so they must be
  1627.   able to interact with the user and load various device drivers.
  1628.   Second, they must be prepared to work with many different installation
  1629.   options, with varying degrees of automation.  Finally, distribution
  1630.   bootdisks usually combine installation and rescue capabilities.
  1631.  
  1632.  
  1633.   Some bootdisks use a feature called initrd (initial ramdisk).  This
  1634.   feature was introduced around 2.0.x and allows a kernel to boot in two
  1635.   phases.  When the kernel first boots, it loads an initial ramdisk
  1636.   image from the boot disk.  This initial ramdisk is a root filesystem
  1637.   containing a program that runs before the real root fs is loaded.
  1638.   This program usually inspects the environment and/or asks the user to
  1639.   select various boot options, such as the device from which to load the
  1640.   real rootdisk.  It typically loads additional modules not built in to
  1641.   the kernel.  When this initial program exits, the kernel loads the
  1642.   real root image and booting continues normally.  For further
  1643.   information on initrd, see /usr/src/linux/Documentation/initrd.txt and
  1644.   <ftp://elserv.ffm.fgan.de/pub/linux/loadlin-1.6/initrd-example.tgz>
  1645.  
  1646.   The following are summaries of how each distribution's installation
  1647.   disks seem to work, based on inspecting their filesystems and/or
  1648.   source code.  We do not guarantee that this information is completely
  1649.   accurate, or that they have not changed since the versions noted.
  1650.  
  1651.   Slackware (v.3.1) uses a straightforward LILO boot similar to what is
  1652.   described in section ``Transferring the kernel with LILO''.  The
  1653.   Slackware bootdisk prints a bootup message (``Welcome to the Slackware
  1654.   Linux bootkernel disk!'') using LILO's message parameter.  This
  1655.   instructs the user to enter a boot parameter line if necessary.  After
  1656.   booting, a root filesystem is loaded from a second disk.  The user
  1657.   invokes a setup script which starts the installation.  Instead of
  1658.   using a modular kernel, Slackware provides many different kernels and
  1659.   depends upon the user to select the one matching his or her hardware
  1660.   requirements.
  1661.  
  1662.   RedHat (v.4.0) also uses a LILO boot.  It loads a compressed ramdisk
  1663.   on the first disk, which runs a custom init program.  This program
  1664.   queries for drivers then loads additional files from a supplemental
  1665.   disk if necessary.
  1666.  
  1667.   Debian (v.1.3) is probably the most sophisticated of the installation
  1668.   disk sets.  It uses the SYSLINUX loader to arrange various load
  1669.   options, then uses an initrd image to guide the user through
  1670.   installation.  It appears to use both a customized init and a
  1671.   customized shell.
  1672.  
  1673.  
  1674.  
  1675.   10.  Frequently asked question (FAQ) list.
  1676.  
  1677.  
  1678.   Q. I boot from my boot/root disks and nothing happens. What do I do?
  1679.  
  1680.  
  1681.   See section ``Troubleshooting'', above.
  1682.  
  1683.   Q. How does the Slackware/Debian/RedHat bootdisk work?
  1684.  
  1685.  
  1686.   See section ``What the pros do'', above.
  1687.  
  1688.  
  1689.   Q. How can I make a boot disk with a XYZ driver?
  1690.  
  1691.  
  1692.   The easiest way is to obtain a Slackware kernel from your nearest
  1693.   Slackware mirror site. Slackware kernels are generic kernels which
  1694.   atttempt to include drivers for as many devices as possible, so if you
  1695.   have a SCSI or IDE controller, chances are that a driver for it is
  1696.   included in the Slackware kernel.
  1697.  
  1698.   Go to the a1 directory and select either IDE or SCSI kernel depending
  1699.   on the type of controller you have. Check the xxxxkern.cfg file for
  1700.   the selected kernel to see the drivers which have been included in
  1701.   that kernel. If the device you want is in that list, then the
  1702.   corresponding kernel should boot your computer. Download the
  1703.   xxxxkern.tgz file and copy it to your boot diskette as described above
  1704.   in the section on making boot disks.
  1705.  
  1706.   You must then check the root device in the kernel, using the rdev
  1707.   command:
  1708.  
  1709.           rdev zImage
  1710.  
  1711.  
  1712.  
  1713.   rdev will then display the current root device in the kernel.  If this
  1714.   is not the same as the root device you want, then use rdev to change
  1715.   it.  For example, the kernel I tried was set to /dev/sda2, but my root
  1716.   SCSI partition is /dev/sda8.  To use a root diskette, you would have
  1717.   to use the command:
  1718.  
  1719.  
  1720.           rdev zImage /dev/fd0
  1721.  
  1722.  
  1723.   If you want to know how to set up a Slackware root disk as well,
  1724.   that's outside the scope of this HOWTO, so I suggest you check the
  1725.   Linux Install Guide or get the Slackware distribution.  See the
  1726.   section in this HOWTO titled ``References''.
  1727.  
  1728.   Q. How do I update my boot diskette with a new kernel?
  1729.  
  1730.  
  1731.   Just copy the kernel to your boot diskette using the dd command for a
  1732.   boot diskette without a filesystem, or the cp command for a boot/root
  1733.   disk. Refer to the section in this HOWTO titled ``Boot'' for details
  1734.   on creating a boot disk. The description applies equally to updating a
  1735.   kernel on a boot disk.
  1736.  
  1737.   Q. How do I update my root diskette with new files?
  1738.  
  1739.  
  1740.   The easiest way is to copy the filesystem from the rootdisk back to
  1741.   the DEVICE you used (from section ``Creating the filesystem'', above).
  1742.   Then mount the filesystem and make the changes.  You have to remember
  1743.   where your root filesystem started and how many blocks it occupied:
  1744.  
  1745.  
  1746.           dd if=/dev/fd0 bs=1k skip=ROOTBEGIN count=BLOCKS | gunzip > DEVICE
  1747.           mount -t ext2 DEVICE /mnt
  1748.  
  1749.  
  1750.  
  1751.   After making the changes, proceed as before (in Section ``Wrapping it
  1752.   up'') and transfer the root filesystem back to the disk.  You should
  1753.   not have to re-transfer the kernel or re-compute the ramdisk word if
  1754.   you do not change the starting position of the new root filesystem.
  1755.  
  1756.  
  1757.   Q. How do I remove LILO so that I can use DOS to boot again?
  1758.  
  1759.  
  1760.   This is not really a Bootdisk topic, but it is asked often.  Within
  1761.   Linux, you can run:
  1762.  
  1763.  
  1764.  
  1765.                /sbin/lilo -u
  1766.  
  1767.  
  1768.  
  1769.   You can also use the dd command to copy the backup saved by LILO to
  1770.   the boot sector.  Refer to the LILO documentation if you wish to do
  1771.   this.
  1772.  
  1773.   Within DOS and Windows you can use the DOS command:
  1774.  
  1775.  
  1776.                FDISK /MBR
  1777.  
  1778.  
  1779.  
  1780.   MBR stands for Master Boot Record, and it replaces the boot sector
  1781.   with a clean DOS one, without affecting the partition table.  Some
  1782.   purists disagree with this, but even the author of LILO, Werner
  1783.   Almesberger, suggests it.  It is easy, and it works.
  1784.  
  1785.  
  1786.  
  1787.   Q. How can I boot if I've lost my kernel and my boot disk?
  1788.  
  1789.  
  1790.   If you don't have a boot disk standing by, probably the easiest method
  1791.   is to obtain a Slackware kernel for your disk controller type (IDE or
  1792.   SCSI) as described above for ``How do I make a boot disk with a XXX
  1793.   driver?''.  You can then boot your computer using this kernel, then
  1794.   repair whatever damage there is.
  1795.  
  1796.   The kernel you get may not have the root device set to the disk type
  1797.   and partition you want. For example, Slackware's generic SCSI kernel
  1798.   has the root device set to /dev/sda2, whereas my root Linux partition
  1799.   happens to be /dev/sda8.  In this case the root device in the kernel
  1800.   will have to be changed.
  1801.  
  1802.   You can still change the root device and ramdisk settings in the
  1803.   kernel even if all you have is a kernel, and some other operating
  1804.   system, such as DOS.
  1805.  
  1806.   rdev changes kernel settings by changing the values at fixed offsets
  1807.   in the kernel file, so you can do the same if you have a hex editor
  1808.   available on whatever systems you do still have running -- for
  1809.   example, Norton Utilities Disk Editor under DOS.  You then need to
  1810.   check and if necessary change the values in the kernel at the
  1811.   following offsets:
  1812.  
  1813.  
  1814.  
  1815.        HEX     DEC  DESCRIPTION
  1816.        0x01F8  504  Low byte of RAMDISK word
  1817.        0x01F9  505  High byte of RAMDISK word
  1818.        0x01FC  508  Root minor device number - see below
  1819.        0X01FD  509  Root major device number - see below
  1820.  
  1821.  
  1822.  
  1823.   The interpretation of the ramdisk word was described in Section
  1824.   ``Setting the ramdisk word'', above.
  1825.  
  1826.   The major and minor device numbers must be set to the device you want
  1827.   to mount your root filesystem on. Some useful values to select from
  1828.   are:
  1829.  
  1830.  
  1831.  
  1832.        DEVICE          MAJOR MINOR
  1833.        /dev/fd0            2     0   1st floppy drive
  1834.        /dev/hda1           3     1   partition 1 on 1st IDE drive
  1835.        /dev/sda1           8     1   partition 1 on 1st SCSI drive
  1836.        /dev/sda8           8     8   partition 8 on 1st SCSI drive
  1837.  
  1838.  
  1839.  
  1840.   Once you have set these values then you can write the file to a
  1841.   diskette using either Norton Utilities Disk Editor, or a program
  1842.   called rawrite.exe.  This program is included in all distributions.
  1843.   It is a DOS program which writes a file to the ``raw'' disk, starting
  1844.   at the boot sector, instead of writing it to the file system.  If you
  1845.   use Norton Utilities you must write the file to a physical disk
  1846.   starting at the beginning of the disk.
  1847.  
  1848.   Q. How can I make extra copies of boot/root diskettes?
  1849.  
  1850.  
  1851.   Because magnetic media may deteriorate over time, you should keep
  1852.   several copies of your rescue disk, in case the original is
  1853.   unreadable.
  1854.  
  1855.   The easiest way of making copies of any diskettes, including bootable
  1856.   and utility diskettes, is to use the dd command to copy the contents
  1857.   of the original diskette to a file on your hard drive, and then use
  1858.   the same command to copy the file back to a new diskette.  Note that
  1859.   you do not need to, and should not, mount the diskettes, because dd
  1860.   uses the raw device interface.
  1861.  
  1862.   To copy the original, enter the command:
  1863.  
  1864.  
  1865.                dd if=DEVICENAME of=FILENAME
  1866.                where   DEVICENAME is the device name of the diskette drive
  1867.                and     FILENAME is the name of the (hard-disk) output file
  1868.  
  1869.  
  1870.  
  1871.   Omitting the count parameter causes dd to copy the whole diskette
  1872.   (2880 blocks if high-density).
  1873.  
  1874.   To copy the resulting file back to a new diskette, insert the new
  1875.   diskette and enter the reverse command:
  1876.  
  1877.  
  1878.                dd if=FILENAME of=DEVICENAME
  1879.  
  1880.  
  1881.  
  1882.   Note that the above discussion assumes that you have only one diskette
  1883.   drive. If you have two of the same type, you can copy diskettes using
  1884.   a command like:
  1885.  
  1886.  
  1887.  
  1888.                dd if=/dev/fd0 of=/dev/fd1
  1889.  
  1890.  
  1891.  
  1892.   Q. How can I boot without typing in "ahaxxxx=nn,nn,nn" every time?
  1893.  
  1894.  
  1895.   Where a disk device cannot be autodetected it is necessary to supply
  1896.   the kernel with a command device parameter string, such as:
  1897.  
  1898.  
  1899.                aha152x=0x340,11,3,1
  1900.  
  1901.  
  1902.  
  1903.   This parameter string can be supplied in several ways using LILO:
  1904.  
  1905.  
  1906.   o  By entering it on the command line every time the system is booted
  1907.      via LILO.  This is boring, though.
  1908.  
  1909.   o  By using the LILO ``lock'' keyword to make it store the command
  1910.      line as the default command line, so that LILO will use the same
  1911.      options every time it boots.
  1912.  
  1913.   o  By using the append= statement in the LILO config file.  Note that
  1914.      the parameter string must be enclosed in quotes.
  1915.  
  1916.   For example, a sample command line using the above parameter string
  1917.   would be:
  1918.  
  1919.  
  1920.                zImage  aha152x=0x340,11,3,1 root=/dev/sda1 lock
  1921.  
  1922.  
  1923.  
  1924.   This would pass the device parameter string through, and also ask the
  1925.   kernel to set the root device to /dev/sda1 and save the whole command
  1926.   line and reuse it for all future boots.
  1927.  
  1928.   A sample APPEND statement is:
  1929.  
  1930.  
  1931.                APPEND = "aha152x=0x340,11,3,1"
  1932.  
  1933.  
  1934.  
  1935.   Note that the parameter string must NOT be enclosed in quotes on the
  1936.   command line, but it MUST be enclosed in quotes in the APPEND
  1937.   statement.
  1938.  
  1939.   Note also that for the parameter string to be acted on, the kernel
  1940.   must contain the driver for that disk type.  If it does not, then
  1941.   there is nothing listening for the parameter string, and you will have
  1942.   to rebuild the kernel to include the required driver.  For details on
  1943.   rebuilding the kernel, cd to /usr/src/linux and read the README, and
  1944.   read the Linux FAQ and Installation HOWTO.  Alternatively you could
  1945.   obtain a generic kernel for the disk type and install that.
  1946.  
  1947.   Readers are strongly urged to read the LILO documentation before
  1948.   experimenting with LILO installation.  Incautious use of the BOOT
  1949.   statement can damage partitions.
  1950.  
  1951.   Q. At boot time, I get error "A: cannot execute B". Why?
  1952.  
  1953.  
  1954.   There are several cases of program names being hardcoded in various
  1955.   utilities.  These cases do not occur everywhere, but they may explain
  1956.   why an executable apparently cannot be found on your system even
  1957.   though you can see that it is there.  You can find out if a given
  1958.   program has the name of another hardcoded by using the strings command
  1959.   and piping the output through grep.
  1960.  
  1961.   Known examples of hardcoding are:
  1962.  
  1963.   o  Shutdown in some versions has /etc/reboot hardcoded, so reboot must
  1964.      be placed in the /etc directory.
  1965.  
  1966.   o  init has caused problems for at least one person, with the kernel
  1967.      being unable to find init.
  1968.  
  1969.   To fix these problems, either move the programs to the correct
  1970.   directory, or change configuration files (e.g. inittab) to point to
  1971.   the correct directory.  If in doubt, put programs in the same
  1972.   directories as they are on your hard disk, and use the same inittab
  1973.   and /etc/rc.d files as they appear on your hard disk.
  1974.  
  1975.   Q. My kernel has ramdisk support, but initializes ramdisks of 0K
  1976.  
  1977.   Where this occurs, a kernel message like this will appear as the
  1978.   kernel is booting:
  1979.  
  1980.  
  1981.           Ramdisk driver initialized : 16 ramdisks of 0K size
  1982.  
  1983.  
  1984.  
  1985.   This is probably because the size has been set to 0 by kernel
  1986.   parameters at boot time.  This could possibly be because of an
  1987.   overlooked LILO configuration file parameter:
  1988.  
  1989.  
  1990.  
  1991.        ramdisk= 0
  1992.  
  1993.  
  1994.  
  1995.   This was included in sample LILO configuration files in some older
  1996.   distributions, and was put there to override any previous kernel
  1997.   setting.  If you have such a line, remove it.
  1998.  
  1999.   Note that if you attempt to use a ramdisk which has been set to 0K the
  2000.   behaviour can be unpredictable, and can result in kernel panics.
  2001.  
  2002.  
  2003.  
  2004.   K.  Resources and pointers.
  2005.  
  2006.  
  2007.   When retrieving a package, always get the latest version unless you
  2008.   have good reasons for not doing so.
  2009.  
  2010.  
  2011.   K.1.  Pre-made bootdisks.
  2012.  
  2013.  
  2014.   These are sources for distribution bootdisks.  Please use one of the
  2015.   mirror sites to reduce the load on these machines.
  2016.  
  2017.  
  2018.   o  Slackware bootdisks
  2019.      <http://metalab.unc.edu/pub/Linux/distributions/slackware/bootdsks.144/>,
  2020.      rootdisks
  2021.      <http://metalab.unc.edu/pub/Linux/distributions/slackware/rootdsks/>
  2022.  
  2023.      and Slackware mirror sites <http://www.slackware.com/getslack/>
  2024.  
  2025.   o  RedHat bootdisks
  2026.      <http://metalab.unc.edu/pub/Linux/distributions/redhat/current/i386/images/>
  2027.      and Red Hat mirror sites <http://www.redhat.com/mirrors.html>
  2028.  
  2029.   o  Debian bootdisks
  2030.      <ftp://ftp.debian.org/pub/debian/dists/stable/main/disks-
  2031.      i386/current/> and Debian mirror sites
  2032.      <ftp://ftp.debian.org/pub/debian/README.mirrors.html>
  2033.  
  2034.   In addition to the distribution bootdisks, the following rescue disk
  2035.   images are available.  Unless otherwise specified, these are available
  2036.   in the directory
  2037.   <http://metalab.unc.edu/pub/Linux/system/recovery/!INDEX.html>
  2038.  
  2039.  
  2040.  
  2041.   o  tomsrtbt, by Tom Oehser, is a single-disk boot/root disk based on
  2042.      kernel 2.0, with a large set of features and support programs.  It
  2043.      supports IDE, SCSI, tape, network adaptors, PCMCIA and more.  About
  2044.      100 utility programs and tools are included for fixing and
  2045.      restoring disks.  The package also includes scripts for
  2046.      disassembling and reconstructing the images so that new material
  2047.      can be added if necessary.
  2048.  
  2049.  
  2050.  
  2051.   o  rescue02, by John Comyns, is a rescue disk based on kernel 1.3.84,
  2052.      with support for IDE and Adaptec 1542 and NCR53C7,8xx.  It uses ELF
  2053.      binaries but it has enough commands so that it can be used on any
  2054.      system.  There are modules that can be loaded after booting for all
  2055.      other SCSI cards.  It probably won't work on systems with 4 mb of
  2056.      ram since it uses a 3 mb ram disk.
  2057.  
  2058.  
  2059.  
  2060.   o  resque_disk-2.0.22, by Sergei Viznyuk, is a full-featured boot/root
  2061.      disk based on kernel 2.0.22 with built-in support for IDE, many
  2062.      difference SCSI controllers, and ELF/AOUT.  Also includes many
  2063.      modules and useful utilities for repairing and restoring a hard
  2064.      disk.
  2065.  
  2066.  
  2067.  
  2068.   o  cramdisk images, based on the 2.0.23 kernel, available for 4 meg
  2069.      and 8 meg machines.  They include math emulation and networking
  2070.      (PPP and dialin script, NE2000, 3C509), or support for the parallel
  2071.      port ZIP drive.  These diskette images will boot on a 386 with 4MB
  2072.      RAM.  MSDOS support is included so you can download from the net to
  2073.      a DOS partition.
  2074.  
  2075.      <http://metalab.unc.edu/pub/Linux/system/recovery/images>
  2076.  
  2077.  
  2078.  
  2079.   K.2.  Rescue packages.
  2080.  
  2081.  
  2082.   Several packages for creating rescue disks are available on
  2083.   metalab.unc.edu.  With these packages you specify a set of files for
  2084.   inclusion and the software automates (to varying degrees) the creation
  2085.   of a bootdisk.  See
  2086.   <http://metalab.unc.edu/pub/Linux/system/recovery/!INDEX.html> for
  2087.   more information.  Check the file dates carefully -- some of these
  2088.   packages have not been updated in several years and will not support
  2089.   the creation of a compressed root filesystem loaded into ramdisk.  To
  2090.   the best of our knowledge, Yard is the only package that will.
  2091.  
  2092.  
  2093.  
  2094.   K.3.  Graham Chapman's shell scripts
  2095.  
  2096.  
  2097.   Graham Chapman has written a set of scripts that may be useful as
  2098.   examples of how to create bootdisks.  In previous versions of this
  2099.   HOWTO the scripts appeared in an appendix, but they have been deleted
  2100.   from the documented and placed on a web page:
  2101.  
  2102.   <http://www.zeta.org.au/~grahamc/linux.html>
  2103.  
  2104.  
  2105.   You may find it convenient to use these scripts, but if so, read the
  2106.   instructions carefully -- for example, if you specify the wrong swap
  2107.   device, you will find your root filesystem has been throroughly and
  2108.   permanently erased.  Be sure you have it correctly configured before
  2109.   you use it!
  2110.  
  2111.  
  2112.  
  2113.   K.4.  LILO -- the Linux loader.
  2114.  
  2115.  
  2116.   Written by Werner Almesberger.  Excellent boot loader, and the
  2117.   documentation includes information on the boot sector contents and the
  2118.   early stages of the boot process.
  2119.  
  2120.   Ftp from  <ftp://tsx-11.mit.edu/pub/linux/packages/lilo/>.  It is also
  2121.   available on Metalab and mirrors.
  2122.  
  2123.  
  2124.   K.5.  Linux FAQ and HOWTOs.
  2125.  
  2126.  
  2127.   These are available from many sources.  Look at the usenet newsgroups
  2128.   news.answers and comp.os.linux.announce.
  2129.  
  2130.   The FAQ is available from  <http://linuxdoc.org/FAQ/Linux-FAQ.html>
  2131.   and the HOWTOs from  <http://linuxdoc.org/HOWTO/HOWTO-INDEX.html>.
  2132.   Most documentation for Linux may be found at The Linux Documentation
  2133.   Project homepage <http://linuxdoc.org/>.
  2134.  
  2135.  
  2136.   K.6.  Ramdisk usage.
  2137.  
  2138.  
  2139.   An excellent description of the how the new ramdisk code works may be
  2140.   found with the documentation supplied with the Linux kernel.  See
  2141.   /usr/src/linux/Documentation/ramdisk.txt.  It is written by Paul
  2142.   Gortmaker and includes a section on creating a compressed ramdisk.
  2143.  
  2144.  
  2145.  
  2146.   K.7.  The Linux boot process.
  2147.  
  2148.  
  2149.   For more detail on the Linux boot process, here are some pointers:
  2150.  
  2151.  
  2152.   o  The Linux System Administrators' Guide has a section on booting,
  2153.      See <http://linuxdoc.org/LDP/sag/c1596.html>
  2154.  
  2155.   o  The LILO ``Technical overview''
  2156.      <http://metalab.unc.edu/pub/Linux/system/boot/lilo/lilo-t-21.ps.gz>
  2157.      has the definitive technical, low-level description of the boot
  2158.      process, up to where the kernel is started.
  2159.  
  2160.   o  The source code is the ultimate guide.  Below are some kernel files
  2161.      related to the boot process.  If you have the Linux kernel source
  2162.      code, you can find these under /usr/src/linux on your machine;
  2163.      alternatively, Shigio Yamaguchi (shigio@tamacom.com) has a very
  2164.      nice hypertext kernel browser at
  2165.      <http://www.tamacom.com/tour/linux/index.html>.  Here are some
  2166.      relevant files:
  2167.  
  2168.  
  2169.  
  2170.      arch/i386/boot/bootsect.S,setup.S
  2171.         Contain assembly code for the bootsector.
  2172.  
  2173.  
  2174.      arch/i386/boot/compressed/misc.c
  2175.         Contains code for uncompressing the kernel.
  2176.  
  2177.  
  2178.      arch/i386/kernel/
  2179.         Directory containing kernel initialization code.  setup.c
  2180.         contains the ramdisk word.
  2181.  
  2182.  
  2183.      drivers/block/rd.c
  2184.         Contains the ramdisk driver. The procedures rd_load and
  2185.         rd_load_image load blocks from a device into a ramdisk.  The
  2186.         procedure identify_ramdisk_image determines what kind of
  2187.         filesystem is found and whether it is compressed.
  2188.  
  2189.  
  2190.  
  2191.   L.  LILO boot error codes.
  2192.  
  2193.  
  2194.   Questions about these errors are asked so often on Usenet that we
  2195.   include them here as a public service.  This summary is excerpted from
  2196.   Werner Almsberger's LILO User Documentation, available at
  2197.   <http://metalab.unc.edu/pub/Linux/system/boot/lilo/lilo-u-21.ps.gz>.
  2198.  
  2199.   When LILO loads itself, it displays the word ``LILO''.  Each letter is
  2200.   printed before or after performing some specific action.  If LILO
  2201.   fails at some point, the letters printed so far can be used to
  2202.   identify the problem.
  2203.  
  2204.  
  2205.  
  2206.      (nothing)
  2207.         No part of LILO has been loaded.  LILO either isn't installed or
  2208.         the partition on which its boot sector is located isn't active.
  2209.  
  2210.  
  2211.      L  The first stage boot loader has been loaded and started, but it
  2212.         can't load the second stage boot loader.  The two-digit error
  2213.         codes indicate the type of problem. (See also section ``Disk
  2214.         error codes''.)  This condition usually indicates a media
  2215.         failure or a geometry mismatch (e.g. bad disk parameters)
  2216.  
  2217.  
  2218.      LI The first stage boot loader was able to load the second stage
  2219.         boot loader, but has failed to execute it. This can either be
  2220.         caused by a geometry mismatch or by moving /boot/boot.b without
  2221.         running the map installer.
  2222.  
  2223.  
  2224.      LIL
  2225.         The second stage boot loader has been started, but it can't load
  2226.         the descriptor table from the map file. This is typically caused
  2227.         by a media failure or by a geometry mismatch.
  2228.  
  2229.  
  2230.      LIL?
  2231.         The second stage boot loader has been loaded at an incorrect
  2232.         address. This is typically caused by a subtle geometry mismatch
  2233.         or by moving /boot/boot.b without running the map installer.
  2234.      LIL-
  2235.         The descriptor table is corrupt. This can either be caused by a
  2236.         geometry mismatch or by moving /boot/map without running the map
  2237.         installer.
  2238.  
  2239.  
  2240.      LILO
  2241.         All parts of LILO have been successfully loaded.
  2242.  
  2243.  
  2244.   If the BIOS signals an error when LILO is trying to load a boot image,
  2245.   the respective error code is displayed.  These codes range from 0x00
  2246.   through 0xbb.  See the LILO User Guide for an explanation of these.
  2247.  
  2248.  
  2249.  
  2250.   M.  Sample rootdisk directory listings.
  2251.  
  2252.  
  2253.  
  2254.   Here are the contents of a sample root filesystem and a utility
  2255.   diskette.
  2256.  
  2257.  
  2258.  
  2259.   Root directory:
  2260.   drwx--x--x   2 root     root         1024 Nov  1 15:39 bin
  2261.   drwx--x--x   2 root     root         4096 Nov  1 15:39 dev
  2262.   drwx--x--x   3 root     root         1024 Nov  1 15:39 etc
  2263.   drwx--x--x   4 root     root         1024 Nov  1 15:39 lib
  2264.   drwx--x--x   5 root     root         1024 Nov  1 15:39 mnt
  2265.   drwx--x--x   2 root     root         1024 Nov  1 15:39 proc
  2266.   drwx--x--x   2 root     root         1024 Nov  1 15:39 root
  2267.   drwx--x--x   2 root     root         1024 Nov  1 15:39 sbin
  2268.   drwx--x--x   2 root     root         1024 Nov  1 15:39 tmp
  2269.   drwx--x--x   7 root     root         1024 Nov  1 15:39 usr
  2270.   drwx--x--x   5 root     root         1024 Nov  1 15:39 var
  2271.  
  2272.   /bin:
  2273.   -rwx--x--x   1 root     root        62660 Nov  1 15:39 ash
  2274.   -rwx--x--x   1 root     root         9032 Nov  1 15:39 cat
  2275.   -rwx--x--x   1 root     root        10276 Nov  1 15:39 chmod
  2276.   -rwx--x--x   1 root     root         9592 Nov  1 15:39 chown
  2277.   -rwx--x--x   1 root     root        23124 Nov  1 15:39 cp
  2278.   -rwx--x--x   1 root     root        23028 Nov  1 15:39 date
  2279.   -rwx--x--x   1 root     root        14052 Nov  1 15:39 dd
  2280.   -rwx--x--x   1 root     root        14144 Nov  1 15:39 df
  2281.   -rwx--x--x   1 root     root        69444 Nov  1 15:39 egrep
  2282.   -rwx--x--x   1 root     root          395 Nov  1 15:39 false
  2283.   -rwx--x--x   1 root     root        69444 Nov  1 15:39 fgrep
  2284.   -rwx--x--x   1 root     root        69444 Nov  1 15:39 grep
  2285.   -rwx--x--x   3 root     root        45436 Nov  1 15:39 gunzip
  2286.   -rwx--x--x   3 root     root        45436 Nov  1 15:39 gzip
  2287.   -rwx--x--x   1 root     root         8008 Nov  1 15:39 hostname
  2288.   -rwx--x--x   1 root     root        12736 Nov  1 15:39 ln
  2289.   -rws--x--x   1 root     root        15284 Nov  1 15:39 login
  2290.   -rwx--x--x   1 root     root        29308 Nov  1 15:39 ls
  2291.   -rwx--x--x   1 root     root         8268 Nov  1 15:39 mkdir
  2292.   -rwx--x--x   1 root     root         8920 Nov  1 15:39 mknod
  2293.   -rwx--x--x   1 root     root        24836 Nov  1 15:39 more
  2294.   -rws--x--x   1 root     root        37640 Nov  1 15:39 mount
  2295.   -rwx--x--x   1 root     root        12240 Nov  1 15:39 mt
  2296.   -rwx--x--x   1 root     root        12932 Nov  1 15:39 mv
  2297.   -r-x--x--x   1 root     root        12324 Nov  1 15:39 ps
  2298.   -rwx--x--x   1 root     root         5388 Nov  1 15:39 pwd
  2299.   -rwx--x--x   1 root     root        10092 Nov  1 15:39 rm
  2300.   lrwxrwxrwx   1 root     root            3 Nov  1 15:39 sh -> ash
  2301.   -rwx--x--x   1 root     root        25296 Nov  1 15:39 stty
  2302.   -rws--x--x   1 root     root        12648 Nov  1 15:39 su
  2303.   -rwx--x--x   1 root     root         4444 Nov  1 15:39 sync
  2304.   -rwx--x--x   1 root     root       110668 Nov  1 15:39 tar
  2305.   -rwx--x--x   1 root     root        19712 Nov  1 15:39 touch
  2306.   -rwx--x--x   1 root     root          395 Nov  1 15:39 true
  2307.   -rws--x--x   1 root     root        19084 Nov  1 15:39 umount
  2308.   -rwx--x--x   1 root     root         5368 Nov  1 15:39 uname
  2309.   -rwx--x--x   3 root     root        45436 Nov  1 15:39 zcat
  2310.  
  2311.   /dev:
  2312.   lrwxrwxrwx   1 root     root            6 Nov  1 15:39 cdrom -> cdu31a
  2313.   brw-rw-r--   1 root     root      15,   0 May  5  1998 cdu31a
  2314.   crw-------   1 root     root       4,   0 Nov  1 15:29 console
  2315.   crw-rw-rw-   1 root     uucp       5,  64 Sep  9 19:46 cua0
  2316.   crw-rw-rw-   1 root     uucp       5,  65 May  5  1998 cua1
  2317.   crw-rw-rw-   1 root     uucp       5,  66 May  5  1998 cua2
  2318.   crw-rw-rw-   1 root     uucp       5,  67 May  5  1998 cua3
  2319.   brw-rw----   1 root     floppy     2,   0 Aug  8 13:54 fd0
  2320.   brw-rw----   1 root     floppy     2,  36 Aug  8 13:54 fd0CompaQ
  2321.   brw-rw----   1 root     floppy     2,  84 Aug  8 13:55 fd0D1040
  2322.   brw-rw----   1 root     floppy     2,  88 Aug  8 13:55 fd0D1120
  2323.   brw-rw----   1 root     floppy     2,  12 Aug  8 13:54 fd0D360
  2324.   brw-rw----   1 root     floppy     2,  16 Aug  8 13:54 fd0D720
  2325.   brw-rw----   1 root     floppy     2, 120 Aug  8 13:55 fd0D800
  2326.   brw-rw----   1 root     floppy     2,  32 Aug  8 13:54 fd0E2880
  2327.   brw-rw----   1 root     floppy     2, 104 Aug  8 13:55 fd0E3200
  2328.   brw-rw----   1 root     floppy     2, 108 Aug  8 13:55 fd0E3520
  2329.   brw-rw----   1 root     floppy     2, 112 Aug  8 13:55 fd0E3840
  2330.   brw-rw----   1 root     floppy     2,  28 Aug  8 13:54 fd0H1440
  2331.   brw-rw----   1 root     floppy     2, 124 Aug  8 13:55 fd0H1600
  2332.   brw-rw----   1 root     floppy     2,  44 Aug  8 13:55 fd0H1680
  2333.   brw-rw----   1 root     floppy     2,  60 Aug  8 13:55 fd0H1722
  2334.   brw-rw----   1 root     floppy     2,  76 Aug  8 13:55 fd0H1743
  2335.   brw-rw----   1 root     floppy     2,  96 Aug  8 13:55 fd0H1760
  2336.   brw-rw----   1 root     floppy     2, 116 Aug  8 13:55 fd0H1840
  2337.   brw-rw----   1 root     floppy     2, 100 Aug  8 13:55 fd0H1920
  2338.   lrwxrwxrwx   1 root     root            7 Nov  1 15:39 fd0H360 -> fd0D360
  2339.   lrwxrwxrwx   1 root     root            7 Nov  1 15:39 fd0H720 -> fd0D720
  2340.   brw-rw----   1 root     floppy     2,  52 Aug  8 13:55 fd0H820
  2341.   brw-rw----   1 root     floppy     2,  68 Aug  8 13:55 fd0H830
  2342.   brw-rw----   1 root     floppy     2,   4 Aug  8 13:54 fd0d360
  2343.   brw-rw----   1 root     floppy     2,   8 Aug  8 13:54 fd0h1200
  2344.   brw-rw----   1 root     floppy     2,  40 Aug  8 13:54 fd0h1440
  2345.   brw-rw----   1 root     floppy     2,  56 Aug  8 13:55 fd0h1476
  2346.   brw-rw----   1 root     floppy     2,  72 Aug  8 13:55 fd0h1494
  2347.   brw-rw----   1 root     floppy     2,  92 Aug  8 13:55 fd0h1600
  2348.   brw-rw----   1 root     floppy     2,  20 Aug  8 13:54 fd0h360
  2349.   brw-rw----   1 root     floppy     2,  48 Aug  8 13:55 fd0h410
  2350.   brw-rw----   1 root     floppy     2,  64 Aug  8 13:55 fd0h420
  2351.   brw-rw----   1 root     floppy     2,  24 Aug  8 13:54 fd0h720
  2352.   brw-rw----   1 root     floppy     2,  80 Aug  8 13:55 fd0h880
  2353.   brw-rw----   1 root     disk       3,   0 May  5  1998 hda
  2354.   brw-rw----   1 root     disk       3,   1 May  5  1998 hda1
  2355.   brw-rw----   1 root     disk       3,   2 May  5  1998 hda2
  2356.   brw-rw----   1 root     disk       3,   3 May  5  1998 hda3
  2357.   brw-rw----   1 root     disk       3,   4 May  5  1998 hda4
  2358.   brw-rw----   1 root     disk       3,   5 May  5  1998 hda5
  2359.   brw-rw----   1 root     disk       3,   6 May  5  1998 hda6
  2360.   brw-rw----   1 root     disk       3,  64 May  5  1998 hdb
  2361.   brw-rw----   1 root     disk       3,  65 May  5  1998 hdb1
  2362.   brw-rw----   1 root     disk       3,  66 May  5  1998 hdb2
  2363.   brw-rw----   1 root     disk       3,  67 May  5  1998 hdb3
  2364.   brw-rw----   1 root     disk       3,  68 May  5  1998 hdb4
  2365.   brw-rw----   1 root     disk       3,  69 May  5  1998 hdb5
  2366.   brw-rw----   1 root     disk       3,  70 May  5  1998 hdb6
  2367.   crw-r-----   1 root     kmem       1,   2 May  5  1998 kmem
  2368.   crw-r-----   1 root     kmem       1,   1 May  5  1998 mem
  2369.   lrwxrwxrwx   1 root     root           12 Nov  1 15:39 modem -> ../dev/ttyS1
  2370.   lrwxrwxrwx   1 root     root           12 Nov  1 15:39 mouse -> ../dev/psaux
  2371.   crw-rw-rw-   1 root     root       1,   3 May  5  1998 null
  2372.   crwxrwxrwx   1 root     root      10,   1 Oct  5 20:22 psaux
  2373.   brw-r-----   1 root     disk       1,   1 May  5  1998 ram
  2374.   brw-rw----   1 root     disk       1,   0 May  5  1998 ram0
  2375.   brw-rw----   1 root     disk       1,   1 May  5  1998 ram1
  2376.   brw-rw----   1 root     disk       1,   2 May  5  1998 ram2
  2377.   brw-rw----   1 root     disk       1,   3 May  5  1998 ram3
  2378.   brw-rw----   1 root     disk       1,   4 May  5  1998 ram4
  2379.   brw-rw----   1 root     disk       1,   5 May  5  1998 ram5
  2380.   brw-rw----   1 root     disk       1,   6 May  5  1998 ram6
  2381.   brw-rw----   1 root     disk       1,   7 May  5  1998 ram7
  2382.   brw-rw----   1 root     disk       1,   8 May  5  1998 ram8
  2383.   brw-rw----   1 root     disk       1,   9 May  5  1998 ram9
  2384.   lrwxrwxrwx   1 root     root            4 Nov  1 15:39 ramdisk -> ram0
  2385.   ***  I have only included devices for the IDE partitions I use.
  2386.   ***  If you use SCSI, then use the /dev/sdXX devices instead.
  2387.   crw-------   1 root     root       4,   0 May  5  1998 tty0
  2388.   crw--w----   1 root     tty        4,   1 Nov  1 15:39 tty1
  2389.   crw-------   1 root     root       4,   2 Nov  1 15:29 tty2
  2390.   crw-------   1 root     root       4,   3 Nov  1 15:29 tty3
  2391.   crw-------   1 root     root       4,   4 Nov  1 15:29 tty4
  2392.   crw-------   1 root     root       4,   5 Nov  1 15:29 tty5
  2393.   crw-------   1 root     root       4,   6 Nov  1 15:29 tty6
  2394.   crw-------   1 root     root       4,   7 May  5  1998 tty7
  2395.   crw-------   1 root     tty        4,   8 May  5  1998 tty8
  2396.   crw-------   1 root     tty        4,   9 May  8 12:57 tty9
  2397.   crw-rw-rw-   1 root     root       4,  65 Nov  1 12:17 ttyS1
  2398.   crw-rw-rw-   1 root     root       1,   5 May  5  1998 zero
  2399.  
  2400.   /etc:
  2401.   -rw-------   1 root     root          164 Nov  1 15:39 conf.modules
  2402.   -rw-------   1 root     root          668 Nov  1 15:39 fstab
  2403.   -rw-------   1 root     root           71 Nov  1 15:39 gettydefs
  2404.   -rw-------   1 root     root          389 Nov  1 15:39 group
  2405.   -rw-------   1 root     root          413 Nov  1 15:39 inittab
  2406.   -rw-------   1 root     root           65 Nov  1 15:39 issue
  2407.   -rw-r--r--   1 root     root          746 Nov  1 15:39 ld.so.cache
  2408.   ***  ld.so.cache is created by ldconfig and caches library locations.
  2409.   ***  Many things break at boot time if ld.so.cache is missing.
  2410.   ***  You can either remake it after creating the bootdisk, or
  2411.   ***  include ldconfig on the bootdisk and run it from an rc.x script
  2412.   ***  to update the cache.
  2413.   -rw-------   1 root     root           32 Nov  1 15:39 motd
  2414.   -rw-------   1 root     root          949 Nov  1 15:39 nsswitch.conf
  2415.   drwx--x--x   2 root     root         1024 Nov  1 15:39 pam.d
  2416.   -rw-------   1 root     root          139 Nov  1 15:39 passwd
  2417.   -rw-------   1 root     root          516 Nov  1 15:39 profile
  2418.   -rwx--x--x   1 root     root          387 Nov  1 15:39 rc
  2419.   -rw-------   1 root     root           55 Nov  1 15:39 shells
  2420.   -rw-------   1 root     root          774 Nov  1 15:39 termcap
  2421.   -rw-------   1 root     root           78 Nov  1 15:39 ttytype
  2422.   lrwxrwxrwx   1 root     root           15 Nov  1 15:39 utmp -> ../var/run/utmp
  2423.   lrwxrwxrwx   1 root     root           15 Nov  1 15:39 wtmp -> ../var/log/wtmp
  2424.  
  2425.   /etc/pam.d:
  2426.   -rw-------   1 root     root          356 Nov  1 15:39 other
  2427.  
  2428.   /lib:
  2429.   *** I have an ELF system with glibc, so I need the ld-2.so loader.
  2430.   -rwxr-xr-x   1 root     root        45415 Nov  1 15:39 ld-2.0.7.so
  2431.   lrwxrwxrwx   1 root     root           11 Nov  1 15:39 ld-linux.so.2 -> ld-2.0.7.so
  2432.   -rwxr-xr-x   1 root     root       731548 Nov  1 15:39 libc-2.0.7.so
  2433.   lrwxrwxrwx   1 root     root           13 Nov  1 15:39 libc.so.6 -> libc-2.0.7.so
  2434.   lrwxrwxrwx   1 root     root           17 Nov  1 15:39 libcom_err.so.2 -> libcom_err.so.2.0
  2435.   -rwxr-xr-x   1 root     root         6209 Nov  1 15:39 libcom_err.so.2.0
  2436.   -rwxr-xr-x   1 root     root       153881 Nov  1 15:39 libcrypt-2.0.7.so
  2437.   lrwxrwxrwx   1 root     root           17 Nov  1 15:39 libcrypt.so.1 -> libcrypt-2.0.7.so
  2438.   -rwxr-xr-x   1 root     root        12962 Nov  1 15:39 libdl-2.0.7.so
  2439.   lrwxrwxrwx   1 root     root           14 Nov  1 15:39 libdl.so.2 -> libdl-2.0.7.so
  2440.   lrwxrwxrwx   1 root     root           16 Nov  1 15:39 libext2fs.so.2 -> libext2fs.so.2.4
  2441.   -rwxr-xr-x   1 root     root        81382 Nov  1 15:39 libext2fs.so.2.4
  2442.   -rwxr-xr-x   1 root     root        25222 Nov  1 15:39 libnsl-2.0.7.so
  2443.   lrwxrwxrwx   1 root     root           15 Nov  1 15:39 libnsl.so.1 -> libnsl-2.0.7.so
  2444.   -rwx--x--x   1 root     root       178336 Nov  1 15:39 libnss_files-2.0.7.so
  2445.   lrwxrwxrwx   1 root     root           21 Nov  1 15:39 libnss_files.so.1 -> libnss_files-2.0.7.so
  2446.   lrwxrwxrwx   1 root     root           14 Nov  1 15:39 libpam.so.0 -> libpam.so.0.64
  2447.   -rwxr-xr-x   1 root     root        26906 Nov  1 15:39 libpam.so.0.64
  2448.   lrwxrwxrwx   1 root     root           19 Nov  1 15:39 libpam_misc.so.0 -> libpam_misc.so.0.64
  2449.   -rwxr-xr-x   1 root     root         7086 Nov  1 15:39 libpam_misc.so.0.64
  2450.   -r-xr-xr-x   1 root     root        35615 Nov  1 15:39 libproc.so.1.2.6
  2451.   lrwxrwxrwx   1 root     root           15 Nov  1 15:39 libpwdb.so.0 -> libpwdb.so.0.54
  2452.   -rw-r--r--   1 root     root       121899 Nov  1 15:39 libpwdb.so.0.54
  2453.   lrwxrwxrwx   1 root     root           19 Nov  1 15:39 libtermcap.so.2 -> libtermcap.so.2.0.8
  2454.   -rwxr-xr-x   1 root     root        12041 Nov  1 15:39 libtermcap.so.2.0.8
  2455.   -rwxr-xr-x   1 root     root        12874 Nov  1 15:39 libutil-2.0.7.so
  2456.   lrwxrwxrwx   1 root     root           16 Nov  1 15:39 libutil.so.1 -> libutil-2.0.7.so
  2457.   lrwxrwxrwx   1 root     root           14 Nov  1 15:39 libuuid.so.1 -> libuuid.so.1.1
  2458.   -rwxr-xr-x   1 root     root         8039 Nov  1 15:39 libuuid.so.1.1
  2459.   drwx--x--x   3 root     root         1024 Nov  1 15:39 modules
  2460.   drwx--x--x   2 root     root         1024 Nov  1 15:39 security
  2461.  
  2462.   /lib/modules:
  2463.   drwx--x--x   4 root     root         1024 Nov  1 15:39 2.0.35
  2464.  
  2465.   /lib/modules/2.0.35:
  2466.   drwx--x--x   2 root     root         1024 Nov  1 15:39 block
  2467.   drwx--x--x   2 root     root         1024 Nov  1 15:39 cdrom
  2468.  
  2469.   /lib/modules/2.0.35/block:
  2470.   -rw-------   1 root     root         7156 Nov  1 15:39 loop.o
  2471.  
  2472.   /lib/modules/2.0.35/cdrom:
  2473.   -rw-------   1 root     root        24108 Nov  1 15:39 cdu31a.o
  2474.  
  2475.   /lib/security:
  2476.   -rwx--x--x   1 root     root         8771 Nov  1 15:39 pam_permit.so
  2477.  
  2478.   ***  Directory stubs for mounting
  2479.   /mnt:
  2480.   drwx--x--x   2 root     root         1024 Nov  1 15:39 SparQ
  2481.   drwx--x--x   2 root     root         1024 Nov  1 15:39 cdrom
  2482.   drwx--x--x   2 root     root         1024 Nov  1 15:39 floppy
  2483.  
  2484.   /proc:
  2485.  
  2486.   /root:
  2487.   -rw-------   1 root     root          176 Nov  1 15:39 .bashrc
  2488.   -rw-------   1 root     root          182 Nov  1 15:39 .cshrc
  2489.   -rw-------   1 root     root           47 Nov  1 15:39 .glintrc
  2490.   -rwx--x--x   1 root     root          455 Nov  1 15:39 .profile
  2491.   -rw-------   1 root     root         4014 Nov  1 15:39 .tcshrc
  2492.  
  2493.   /sbin:
  2494.   -rwx--x--x   1 root     root        23976 Nov  1 15:39 depmod
  2495.   -rwx--x--x   2 root     root       274600 Nov  1 15:39 e2fsck
  2496.   -rwx--x--x   1 root     root        41268 Nov  1 15:39 fdisk
  2497.   -rwx--x--x   1 root     root         9396 Nov  1 15:39 fsck
  2498.   -rwx--x--x   2 root     root       274600 Nov  1 15:39 fsck.ext2
  2499.   -rwx--x--x   1 root     root        29556 Nov  1 15:39 getty
  2500.   -rwx--x--x   1 root     root         6620 Nov  1 15:39 halt
  2501.   -rwx--x--x   1 root     root        23116 Nov  1 15:39 init
  2502.   -rwx--x--x   1 root     root        25612 Nov  1 15:39 insmod
  2503.   -rwx--x--x   1 root     root        10368 Nov  1 15:39 kerneld
  2504.   -rwx--x--x   1 root     root       110400 Nov  1 15:39 ldconfig
  2505.   -rwx--x--x   1 root     root         6108 Nov  1 15:39 lsmod
  2506.   -rwx--x--x   2 root     root        17400 Nov  1 15:39 mke2fs
  2507.   -rwx--x--x   1 root     root         4072 Nov  1 15:39 mkfs
  2508.   -rwx--x--x   2 root     root        17400 Nov  1 15:39 mkfs.ext2
  2509.   -rwx--x--x   1 root     root         5664 Nov  1 15:39 mkswap
  2510.   -rwx--x--x   1 root     root        22032 Nov  1 15:39 modprobe
  2511.   lrwxrwxrwx   1 root     root            4 Nov  1 15:39 reboot -> halt
  2512.   -rwx--x--x   1 root     root         7492 Nov  1 15:39 rmmod
  2513.   -rwx--x--x   1 root     root        12932 Nov  1 15:39 shutdown
  2514.   lrwxrwxrwx   1 root     root            6 Nov  1 15:39 swapoff -> swapon
  2515.   -rwx--x--x   1 root     root         5124 Nov  1 15:39 swapon
  2516.   lrwxrwxrwx   1 root     root            4 Nov  1 15:39 telinit -> init
  2517.   -rwx--x--x   1 root     root         6944 Nov  1 15:39 update
  2518.  
  2519.   /tmp:
  2520.  
  2521.   /usr:
  2522.   drwx--x--x   2 root     root         1024 Nov  1 15:39 bin
  2523.   drwx--x--x   2 root     root         1024 Nov  1 15:39 lib
  2524.   drwx--x--x   3 root     root         1024 Nov  1 15:39 man
  2525.   drwx--x--x   2 root     root         1024 Nov  1 15:39 sbin
  2526.   drwx--x--x   3 root     root         1024 Nov  1 15:39 share
  2527.   lrwxrwxrwx   1 root     root           10 Nov  1 15:39 tmp -> ../var/tmp
  2528.  
  2529.   /usr/bin:
  2530.   -rwx--x--x   1 root     root        37164 Nov  1 15:39 afio
  2531.   -rwx--x--x   1 root     root         5044 Nov  1 15:39 chroot
  2532.   -rwx--x--x   1 root     root        10656 Nov  1 15:39 cut
  2533.   -rwx--x--x   1 root     root        63652 Nov  1 15:39 diff
  2534.   -rwx--x--x   1 root     root        12972 Nov  1 15:39 du
  2535.   -rwx--x--x   1 root     root        56552 Nov  1 15:39 find
  2536.   -r-x--x--x   1 root     root         6280 Nov  1 15:39 free
  2537.   -rwx--x--x   1 root     root         7680 Nov  1 15:39 head
  2538.   -rwx--x--x   1 root     root         8504 Nov  1 15:39 id
  2539.   -r-sr-xr-x   1 root     bin          4200 Nov  1 15:39 passwd
  2540.   -rwx--x--x   1 root     root        14856 Nov  1 15:39 tail
  2541.   -rwx--x--x   1 root     root        19008 Nov  1 15:39 tr
  2542.   -rwx--x--x   1 root     root         7160 Nov  1 15:39 wc
  2543.   -rwx--x--x   1 root     root         4412 Nov  1 15:39 whoami
  2544.  
  2545.   /usr/lib:
  2546.   lrwxrwxrwx   1 root     root           17 Nov  1 15:39 libncurses.so.4 -> libncurses.so.4.2
  2547.   -rw-r--r--   1 root     root       260474 Nov  1 15:39 libncurses.so.4.2
  2548.  
  2549.   /usr/sbin:
  2550.   -r-x--x--x   1 root     root        13684 Nov  1 15:39 fuser
  2551.   -rwx--x--x   1 root     root         3876 Nov  1 15:39 mklost+found
  2552.  
  2553.   /usr/share:
  2554.   drwx--x--x   4 root     root         1024 Nov  1 15:39 terminfo
  2555.  
  2556.   /usr/share/terminfo:
  2557.   drwx--x--x   2 root     root         1024 Nov  1 15:39 l
  2558.   drwx--x--x   2 root     root         1024 Nov  1 15:39 v
  2559.  
  2560.   /usr/share/terminfo/l:
  2561.   -rw-------   1 root     root         1552 Nov  1 15:39 linux
  2562.   -rw-------   1 root     root         1516 Nov  1 15:39 linux-m
  2563.   -rw-------   1 root     root         1583 Nov  1 15:39 linux-nic
  2564.  
  2565.   /usr/share/terminfo/v:
  2566.   -rw-------   2 root     root         1143 Nov  1 15:39 vt100
  2567.   -rw-------   2 root     root         1143 Nov  1 15:39 vt100-am
  2568.  
  2569.   /var:
  2570.   drwx--x--x   2 root     root         1024 Nov  1 15:39 log
  2571.   drwx--x--x   2 root     root         1024 Nov  1 15:39 run
  2572.   drwx--x--x   2 root     root         1024 Nov  1 15:39 tmp
  2573.  
  2574.   /var/log:
  2575.   -rw-------   1 root     root            0 Nov  1 15:39 wtmp
  2576.  
  2577.   /var/run:
  2578.   -rw-------   1 root     root            0 Nov  1 15:39 utmp
  2579.  
  2580.   /var/tmp:
  2581.  
  2582.  
  2583.  
  2584.   N.  Sample utility disk directory listing.
  2585.  
  2586.  
  2587.  
  2588.        total 579
  2589.        -rwxr-xr-x   1 root     root        42333 Jul 28 19:05 cpio*
  2590.        -rwxr-xr-x   1 root     root        32844 Aug 28 19:50 debugfs*
  2591.        -rwxr-xr-x   1 root     root       103560 Jul 29 21:31 elvis*
  2592.        -rwxr-xr-x   1 root     root        29536 Jul 28 19:04 fdisk*
  2593.        -rw-r--r--   1 root     root       128254 Jul 28 19:03 ftape.o
  2594.        -rwxr-xr-x   1 root     root        17564 Jul 25 03:21 ftmt*
  2595.        -rwxr-xr-x   1 root     root        64161 Jul 29 20:47 grep*
  2596.        -rwxr-xr-x   1 root     root        45309 Jul 29 20:48 gzip*
  2597.        -rwxr-xr-x   1 root     root        23560 Jul 28 19:04 insmod*
  2598.        -rwxr-xr-x   1 root     root          118 Jul 28 19:04 lsmod*
  2599.        lrwxrwxrwx   1 root     root            5 Jul 28 19:04 mt -> mt-st*
  2600.        -rwxr-xr-x   1 root     root         9573 Jul 28 19:03 mt-st*
  2601.        lrwxrwxrwx   1 root     root            6 Jul 28 19:05 rmmod -> insmod*
  2602.        -rwxr-xr-x   1 root     root       104085 Jul 28 19:05 tar*
  2603.        lrwxrwxrwx   1 root     root            5 Jul 29 21:35 vi -> elvis*
  2604.  
  2605.  
  2606.  
  2607.